home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 August: Tool Chest / Dev.CD Aug 98 TC.toast / Tool Chest / Development Kits / MPW etc. / Debuggers / SADE / SADE 1.3.3 / sade.help < prev    next >
Encoding:
Text File  |  1992-06-12  |  100.1 KB  |  2,888 lines  |  [TEXT/sade]

  1. SADE 1.3 Help Summaries
  2.  
  3.     Help summaries are available for each of the SADE commands.    
  4.     To see the list of commands enter "Help Commands". In addition, 
  5.     brief descriptions of Variables, Constants, Expressions, built
  6.     in functions, and Shortcuts are also included.
  7.  
  8.     To see Help summaries, Enter a command such as
  9.  
  10.     Help Builtins        # a list of builtin (predefined) variables and functions
  11.     Help commandName    # information about commandName
  12.     Help Commands        # a list of commands
  13.     Help Expressions    # summary of expressions
  14.     Help Patterns        # summary of patterns (regular expressions)
  15.     Help Shortcuts        # summary of SADE shortcuts
  16.     Help Variables         # summary of variable references
  17.     Help Basetypes        # summary of basic types recognized by SADE
  18.  
  19.     Copyright Apple Computer, Inc. 1987-1992
  20.     All rights reserved.
  21.  
  22. -    
  23. Builtins
  24.  
  25.     Functions
  26.         AddrToSource    # tries to display source for a particular code address
  27.         Concat             # concatenate strings
  28.         Confirm            # confirmation dialog
  29.         Copy             # extract a substring from a string
  30.         Eval            # evaluate the contents of a string
  31.         Find            # find pattern in memory
  32.         Length             # length of a string
  33.         NaN             # SANE NaN (Not a Number)
  34.         Request            # request dialog returning string
  35.         SizeOf             # size of a value or type
  36.         SourceToAddr    # tries to give code address for a point in a source file
  37.         Timer            # "tick count" timer with conversion to minutes,seconds,hundreths
  38.         TypeOf             # type (name) of a value
  39.         Undef             # is a value undefined?
  40.         Where             # symbolic representation of an address
  41.     
  42.     Variables
  43.         Arg[n]             # n'th parameter to current Proc or Func
  44.         ActiveWindow    # string with pathname of topmost SADE window
  45.         Date            # string with current date in the form dd-mmm-yy
  46.         DisAsmFormat    # string controlling format of DisAsm command output
  47.         Exception         # number of last exception raised
  48.         Inf             # SANE infinity
  49.         NArgs             # number of actual parameters to current Proc or Func
  50.         ProcessId         # id of current process being debugged (an integer)
  51.         TargetWindow    # string with pathname of the SADE window below the topmost one
  52.         Time            # string with current time in the form hh:mm:ss
  53.         WorksheetWindow    # string with pathname of SADE Worksheet window
  54.  
  55. -    
  56. Commands
  57.  
  58.     Abort            Execute            OnEntry                Stack
  59.     AddMenu            Find            Open                Step
  60.     Alert            For                Printf                Stop
  61.     Beep            Func            Proc                Target
  62.     Begin            Go                Quit                Trace
  63.     Break            Heap            Redirect            Unbreak    
  64.     Case            Help            Repeat                Undefine
  65.     Close            If                Resource            Untrace
  66.     Cycle            Kill            Return                Version
  67.     Define            Leave            SADEKey                While
  68.     DeleteMenu        List            Save                WindowSize
  69.     Directory        Loop            Shutdown            
  70.     Disasm            Macro            SizeWindow            
  71.     Dump            MoveWindow      SourcePath                             
  72.  
  73. Functions
  74.  
  75.     AddrToSource      Eval            Request          Timer
  76.     Concat            Find            Selection        TypeOf
  77.     Confirm           Length          SizeOf           Undef
  78.     Copy              Nan             SourceToAddr     Where
  79. -
  80. Expressions
  81.  
  82.     The operators listed below are used in expressions in command
  83.     parameters. 
  84.  
  85.     (…)             grouping
  86.     
  87.     @                address of
  88.     †                trap expression
  89.     
  90.     ^                pointer to
  91.     .                variable reference qualifier
  92.  
  93.     -                unary negation
  94.     ~                bitwise ones complement
  95.     !     NOT  ¬     logical NOT (¬ is Option-L)
  96.  
  97.     *                multiplication
  98.     /     DIV  ÷        division (÷ is Option-/)
  99.     //     MOD        remainder
  100.  
  101.     +                addition
  102.     -                subtraction
  103.  
  104.     <<                shift left
  105.     >>                shift right
  106.  
  107.     =     ==            equal
  108.     <>   !=      ≠     not equal (≠ is Option-=)
  109.     <                less than
  110.     <=     ≤            less than or equal (≤ is Option-<)
  111.     >                greater than
  112.     >=     ≥            greater than or equal (≥ is Option->)
  113.  
  114.     &     AND        bitwise AND
  115.     &&                logical AND
  116.  
  117.     XOR     EOR        bitwise exclusive OR
  118.     |     OR            bitwise OR
  119.     ||                logical OR
  120.     
  121.     :=                size compatible assignment
  122.     <-                arbitrary assignment
  123.  
  124.     Alternate spellings of several operators are provided.
  125.     All of the operators are evaluated from left to right.
  126.     Operators with the highest precedence are listed first,
  127.     and operators in the same group have equal precedence.
  128.  
  129. -
  130. Patterns - Patterns specify characters to be matched.  Patterns may only be
  131.            used from the Find… command in the Find menu.
  132.  
  133.     /entireRE/                regular expression - search forward
  134.     \entireRE\                regular expression - search backward
  135.     
  136. entireRE
  137.  
  138.     •RE                     regular expression at beginning of line (Option-8)
  139.     RE∞                     regular expression at end of line (Option-5)
  140.     RE                        regular expression
  141.     
  142. RE
  143.  
  144.     simpleExpr                simple regular expression - defined below
  145.     'string'                literal - no characters within '…' are special
  146.     "string"                literal - only \, ∂, {, and ` are special within '…'
  147.     RE1RE2                    regular expression RE1 followed by RE2
  148.     
  149. simpleExpr
  150.     
  151.     (RE)                    regular expression grouping
  152.     charExpr                single character regular expression - defined below
  153.     simpleExpr*             simple expression zero or more times
  154.     simpleExpr+             simple expression one of more times
  155.     simpleExpr«n»            simple expression n times (Option-\, Option-Shift-\)
  156.     simpleExpr«n,»            simple expression at least n times
  157.     simpleExpr«n1,n2»        simple expression at least n1, at most n2 times
  158.     
  159. charExpr
  160.     
  161.     character                character (unless it has special meaning)
  162.     ∂character                character - defeats any special meaning (Option-D)
  163.     ?                        any character except Return
  164.     ≈                        zero or more characters, except Return (Option-X)
  165.     [charList]                any character in the list
  166.     [¬charList]             any character not in the list (Option-L)
  167.     
  168. charList
  169.  
  170.     ]                        ] first in the list represents itself
  171.     -                        - first in the list represents itself
  172.     character                character
  173.     charList character        list of characters
  174.     character-character     character range (e.g. A-Z)
  175.     
  176. -
  177. ShortCuts
  178.     The following is a list of SADE shortcuts:
  179.     
  180.     Double click        select word
  181.     Triple click        select line
  182.     Double clicking before any quote (', ", or `) will select until
  183.         the matching quote
  184.     Double clicking before or after {}[]() will select until
  185.         the matching character
  186.  
  187.     UpArrow             move selection point one line above current selection
  188.     DownArrow           move selection point one line below current selection
  189.     RightArrow          move selection point one character to the right
  190.     LeftArrow           move selection point one character to the left
  191.     
  192.     
  193.     CMD-Shift-UpArrow    select text from current selection point to top of screen
  194.     CMD-Shift-DownArrow    select text from current selection point to bottom of screen
  195.         
  196.         
  197.     CMD-Opt-UpArrow       move selection point to top of file
  198.     CMD-Opt-DownArrow     move selection point to bottom of file
  199.     CMD-DownArrow       move selection point down to bottom of screen
  200.     CMD-RightArrow      move selection point to right edge of current line
  201.     CMD-UpArrow         move selection point to top of screen
  202.     CMD-LeftArrow       move selection point to left edge of current line
  203.     CMD-Backspace       delete from current selection to end of file
  204.     
  205.     In Dialogs without an Edittext item
  206.         Y               Yes
  207.         N               No
  208.         CMD .           Cancel
  209.  
  210. -
  211. Variables
  212.     VARIABLE REFERENCES
  213.     
  214.     There are three different types of variables -- program variables, debugger
  215.     variables, and system variables.  Program variables are defined in your
  216.     program; debugger variables are defined during your debugging session; and
  217.     system variables represent objects in the Macintosh runtime environment 
  218.     (e.g., registers, low-memory globals, and ROM locations).
  219.     
  220.     When SADE looks up a simple symbol name, it is first looked up as a debugger
  221.     symbol, then as a program symbol, and finally as a system symbol.  Thus, if
  222.     the same name is used as a debugger symbol and as a program symbol the
  223.     debugger symbol will be returned.  In order to resolve such potential name
  224.     conflicts SADE supports two escape characters, which may preceed an 
  225.     identifier to indicate whether the identifier is a program or system symbol:
  226.         
  227.         ` (backquote) identifies a symbol as a program symbol
  228.         Δ (option j)  identifies a symbol as a system symbol
  229.     
  230.     PROGRAM VARIABLES
  231.     
  232.     The simplest form of program variable reference is just the name of the
  233.     variable itself.  A simple reference (a single identifier) is looked up
  234.     in the current name scope (CNS) as defined by where execution has stopped 
  235.     in the program.  If execution has stopped in a particular procedure, then 
  236.     the variables of that procedure and the global variables in the compilation
  237.     unit of that procedure will be accessible via simple references.
  238.     
  239.     If you need to reference a variable which is outside of the current name
  240.     scope (i.e., not in the procedure where execution has been suspended or
  241.     not one of the globals in the compilation unit of that procedure) then a
  242.     fully qualified reference is needed.  A fully qualified reference is very 
  243.     much like a complete file pathname describing how to get to the variable
  244.     from a particular compilation unit.  The syntax is:
  245.         
  246.         \unit [.procedure]* .variable
  247.         
  248.     where \ indicates that a unit name follows.  In Pascal this will be the name
  249.     on the UNIT or PROGRAM statement; in C or assembly this will be the name of
  250.     the compilation unit's file (with ∂'s used to escape any characters not
  251.     normally allowed in identifiers).  The [.procedure]* indicates zero or
  252.     more procedure names (more than one for nested procedures) separated by dots.
  253.     This will identify the path to a variable when it is not in the current CNS.
  254.     
  255.     DEBUGGER VARIABLES
  256.     
  257.     Debugger variables are defined with the DEFINE command.  These variables
  258.     can be used to save values from the user program, to control debugger
  259.     language contructs, etc.  Debugger variables are untyped, that is, they
  260.     take on the type of the value that is assigned to them (which may change
  261.     the next time they are assigned to).  The format of the define command is:
  262.     
  263.         Define [global] {declaration [':=' initialization]},…
  264.     
  265.     where
  266.           "declaration" is a variable name followed by an optional dimension
  267.             specification in square brackets, and
  268.         "initialization" is a simple expression in the case of a scalar
  269.             variable, or, an parenthesized list of expressions (separated by
  270.             commas) in the case of an array variable.  A list of values for
  271.             an array may include items of the form "n of v" where "n" is
  272.             an expression specifying a count and "v" is an expression specifying
  273.             a particular value.
  274.     
  275.     Any number of variables may be declared in a single DEFINE command.  The
  276.     DEFINE command is not allowed inside of conditional or looping constructs.
  277.     
  278.     Arrays/Scalars:
  279.         Scalar variables hold a value of any type.  An array variable will hold
  280.         up to its specified dimension of values of any type; these values may
  281.         be heterogeneous, that is, they need not be of the same type.
  282.     
  283.     Scope:
  284.         Variables which are defined outside of PROCs or FUNCs are global, and
  285.         are accessible both inside and outside of PROCs.  Variables which are
  286.         defined inside of PROCs and FUNCs are local and have a lifetime limited
  287.         to the particular activation of the PROC or FUNC, unless the optional
  288.         "global" keyword was specified in the DEFINE command.
  289.         
  290. -
  291. Basetypes
  292.  
  293.     The following basic types are recognized by SADE.  They are grouped in
  294.     order of increasing size or related category:
  295.     
  296.     Boolean            # 1 byte Pascal boolean (bit 0 = 0 ==> false; 1 ==> true)
  297.     UnsignedByte    # Unsigned byte
  298.     Byte            # Signed byte
  299.     Cchar            # Character byte
  300.  
  301.     UnsignedWord    # Unsigned word (2 bytes)
  302.     UnsignedShort    # Same as UnsignedWord
  303.     Word            # Signed word
  304.     Short            # Same as Word
  305.     Integer            # Same as Word
  306.     Pchar            # Pascal character word (low byte contains character)
  307.     PascalChar        # Same a Pchar
  308.  
  309.     UnsignedLong    # Unsigned long (4 bytes)
  310.     UnsignedInt        # Same as UnsignedLong
  311.     Long            # Signed long
  312.     Int                # Same as long
  313.     LongInt            # Same as Long
  314.  
  315.     PString            # Pascal variable length string
  316.     CString            # C null-terminated string
  317.     AsIsString        # As-is string (Packed array of char)
  318.  
  319.     Real            # Floating point single precision (4 bytes)
  320.     Float            # Same as Real
  321.     Single            # Same as Single
  322.     Double            # Floating point double precision (8 bytes)
  323.     Extended        # Floating point extended precision (10 bytes)
  324.     Extended12        # MC68881 floating point extended precision (12 bytes)
  325.     Comp[utational]    # Floating point computational integer (8 bytes)
  326. -
  327. Abort —stops execution of scripts
  328.  Syntax    
  329.      Abort
  330.  
  331.  Description    
  332.     The Abort command terminates execution of the current script and 
  333.  returns you to SADE, canceling all pending commands. This means that if current 
  334.  execution is within a structured statement (Begin...End, for instance), or if multiple 
  335.  commands are selected, these pending commands are not executed. To terminate a break 
  336.  action without canceling pending commands, use the Stop command.
  337.  
  338.  Example    
  339.  
  340.     The way in which  keyDown and mouseDown events are handled by the EventFilter 
  341.  procedure in this example illustrates the difference between Abort and Stop. A 
  342.  keyDown event (in the context of this example) does not entail any additional action, 
  343.  so you can use Abort to terminate the break action and return to SADE immediately. In 
  344.  the case of a mouseDown event, however, the location of the mouse when the break 
  345.  occurs is important; therefore, you use Stop to terminate the break action so that the 
  346.  Printf command showing the location of the mouse is executed before SADE is 
  347.  reentered.
  348.  
  349.  
  350.  #-- Establish target, suspending application
  351.  #-- and reentering SADE at main.(1)
  352.  
  353.  Directory 'VolName:some:path:toProg:'
  354.  Target 'MyProg'
  355.  Break \MyProg.main.(1)
  356.  
  357.  #-- Break action examines the current event type
  358.  #-- (assuming the event record is named myEvent).
  359.  #-- For mouseDown, shows coordinates of mouseDown and stops
  360.  #-- (quitting break action but executing rest of pending SADE commands)
  361.  #-- For keyDown, aborts (quitting break action AND rest of commands).
  362.  #-- For any other event, shows event type and continues executing
  363.  #-- (by default, break actions end with an implicit Go command)
  364.  
  365.  Proc EventFilter
  366.     Define global mouseAt;
  367.     If myEvent.what = 1 then    # mouseDown event
  368.         mouseAt := myEvent.Where;
  369.     Stop;
  370.     elseif myEvent.what = 3 # keyDown event
  371.         "keyDown"; Abort;
  372.     else
  373.         Printf "Event type %d: \n", myEvent.what;
  374.         Printf;
  375.     End
  376.  End
  377.  
  378.  Begin
  379.     Break _getNextEvent from applzone..applzone^ EventFilter
  380.     Go
  381.     Printf "Mouse down at H: %d\n          V: %d\n", mouseAt.h, mouseAt.v;
  382.  End
  383.  
  384.  #-- output
  385.  Event type 0:
  386.  Event type 8:
  387.  Event type 6:
  388.  Mouse down at H: 208
  389.                V: 144
  390.  
  391.  #-- With same break action in place, restart target.
  392.  Go
  393.  
  394.  #-- output
  395.  Event type 6:
  396.  keyDown
  397.  
  398.  See also    Break, Stop 
  399. -
  400. AddMenu —creates a menu or adds menu items
  401.  Syntax    
  402.      AddMenu [ menuName  [ itemName  [ command  ] ] ]
  403.  
  404.  Description    
  405.     The AddMenu command lets you create menus and add menu items to 
  406.  execute SADE commands. The parameters menuName, itemName, and command 
  407.  are all string expressions; if they are string constants, you must enclose them in 
  408.  quotation marks.
  409.  
  410.     If a menu of menuName does not exist in the menu bar, a new menu is created. If a
  411.  menu item with the specified itemName already exists, it is replaced; otherwise, a new 
  412.  menu item is created. You can include a keyboard equivalent for the item by listing 
  413.  the key after a slash (/) at the end of the string. See the “Examples” section. 
  414.  (Warning: Be careful not to inadvertently specify a keyboard equivalent that is 
  415.  already defined for a different menu item, because the new definition will replace the 
  416.  existing one without any warning.)
  417.     The command specifies a string that is executed when a user clicks on itemName. 
  418.  It can be a SADE command (see the first example), or something more complex, 
  419.  such as the name of a procedure that you have defined (see the second example).
  420.     If you do not specify itemName or command, AddMenu returns the current value 
  421.  from the specified level down. For instance, if you specify itemName without any 
  422.  commands, AddMenu displays the command that’s currently defined for that menu 
  423.  item. If you omit menuName, itemName, and commandName as well, SADE returns 
  424.  the current values for all user-defined menus and menu items.
  425.  
  426.  Example 1    
  427.  
  428.  #-- Create a menu called Debug with two items, Disasm and Code 
  429.  #-- Disasm disassembles instructions starting at the end of the last 
  430.  #-- disassembly. Code Resources displays information about code resources. 
  431.  #-- Note that you can invoke Disasm from the keyboard with Command-4.
  432.  
  433.  AddMenu 'Debug' 'Disasm/4' 'Disasm'
  434.  AddMenu 'Debug' 'Code Resources' 'Heap restype "CODE"'
  435.  
  436.  Example 2    
  437.  
  438.  #-- Define a procedure called ShowWhere and then create a menu item, 
  439.  #-- Statement Selected Is?, which executes this procedure. ShowWhere shows what 
  440.  #-- routine a selected statement belongs to; if there isn't sufficient symbol 
  441.  #-- information, ShowWhere displays an error message explaining why it cannot 
  442.  #-- show the routine name. 
  443.  
  444.  Proc ShowWhere
  445.     Define loc := SourceToAddr(ActiveWindow, 1)
  446.     If typeOf(loc) = 'PString' then
  447.         Alert Concat('Cannot determine address from source: ', loc)
  448.     else
  449.         Alert Concat('At ', Where(loc))
  450.     End
  451.  End
  452.  
  453.  AddMenu 'SourceCmds' 'Statement Selected Is?' 'ShowWhere'
  454.  
  455.  See also    DeleteMenu
  456. -
  457. AddrToSource —displays source statement corresponding to address
  458.  Syntax    
  459.     AddrToSource (address [, Boolean ] )   
  460.  
  461.  Description    
  462.     AddrToSource displays and selects the source statement corresponding 
  463.  to the specified address. If the source file isn’t already open, it is displayed as 
  464.  a read-only window. If the source file is already open as a read/write window,  
  465.  AddrToSource changes the window to read-only.
  466.     If you omit the optional Boolean value or specify 0 (FALSE), SADE displays 
  467.  the source window behind the front most window (most likely the window from which  
  468.  you executed AddrToSource). If you specify a nonzero value for Boolean (TRUE), SADE 
  469.  brings up the window as the front most window.
  470.     AddrToSource returns a Boolean value indicating whether it was able to display the 
  471.  source statement (TRUE) or not (FALSE).
  472.  
  473.  See also    SourceToAddr
  474. -
  475. Alert —displays an alert box
  476.  
  477.  Syntax    
  478.      Alert [ Beep ] message
  479.  
  480.  Description    
  481.     The Alert command displays an alert box containing the specified 
  482.  message. The alert box is displayed until you click the OK button. Message is 
  483.  a string expression; if it is a string constant, it must be enclosed in quotation 
  484.  marks. If beep is specified, a sound is generated when the alert box appears.
  485.  
  486.  Example
  487.  
  488.  If length(str) > 64 then
  489.     Alert "string longer than expected"
  490.  End 
  491.  
  492.  See also    Beep
  493. -
  494. Beep —generates tones
  495.  Syntax    
  496.      Beep [ note [,duration [,level ] ] ... ]
  497.  
  498.  Description    
  499.     The Beep command produces each given note for the specified duration and
  500.  sound level. You must separate each note specification (that is each note and 
  501.  its optional duration and level) from the next note by blank spaces or tabs. 
  502.  If you do not specify note, SADE produces a standard Macintosh warning beep of  
  503.  predetermined pitch and duration.
  504.  
  505.      Note can be one of the following:
  506.     •    A number indicating the count field for the square wave generator, as 
  507.         described in the Sound Driver chapter of Inside Macintosh, Volume II
  508.     •    A string in the format [n ] letter [ # | b ], where n is an optional number 
  509.         indicating the octaves below or above middle C, followed by a letter 
  510.         indicating the note (A–G) and an optional sharp (#) or flat (b) character.
  511.  
  512.     Duration is specified in sixtieths of a second. The default duration 
  513.     is 15 (one-quarter second).
  514.  
  515.     Level specifies the magnitude of the sound. Your parameter can be a number 
  516.     from 0 to 255. The default level is 128.
  517.  
  518.  Example    
  519.  
  520.  Beep '2C,20,75 2C#,40,150 -1D,60,75'
  521.  
  522.  #-- Play the three notes specified: C, C sharp, and D, for one-third, 
  523.  #-- two-thirds, and one full second, respectively. The middle note is 
  524.  #-- twice as loud as the other notes. C and C sharp are two octaves
  525.  #-- above middle C. D is one octave below.
  526.  
  527.  See also    Alert
  528. -
  529. Begin ...End —groups commands
  530.  Syntax    
  531.      Begin
  532.         commands
  533.     End
  534.  
  535.  Description    
  536.      The Begin...End construct allows you to group together or bracket a 
  537.  sequence of commands. You can use this construct to specify a break action 
  538.  consisting of multiple commands or procedure calls.
  539.  
  540.  Example 1
  541.  
  542.  #-- This example specifies a conditional break action that depends on the 
  543.  #-- value of the pointer theStr^.
  544.  
  545.  Break DisplayString.(4) Begin
  546.     str := theStr^   # save value of parameter in variable str
  547.     If str = '***' then 
  548.         Stop
  549.     End
  550.  End
  551.  
  552.  Example 2
  553.  
  554.  #-- This example shows how to use the Begin…End construct to nest Step commands.
  555.  
  556.  Step onEntry Begin
  557.     Printf "gStopped is %d\n",gStopped
  558.     Printf "newStopped is %d\n",newStopped
  559.     Step onEntry Begin
  560.         Printf "gStopped is %d\n",gStopped
  561.         Printf "newStopped is %d\n",newStopped
  562.     End
  563.  End
  564. -
  565. Break —sets breakpoints
  566.  Syntax    
  567.      Break addr ,... [ breakAction ]
  568.         or
  569.     Break  trap [ from addrRange ] ,... [ breakAction ]
  570.         or
  571.     Break  trapRange [ from addrRange ] ,... [ breakAction ]
  572.         or
  573.     Break all traps  [ from addrRange ] [ breakAction ]
  574.  
  575. Description    
  576.      The Break command sets one or more breakpoints in a target program’s 
  577.  code. There are two types of breakpoints: address breakpoints and trap breakpoints. 
  578.  You can follow either kind of breakpoint by a break action, that is, a command (or 
  579.  series of commands) that is executed when the breakpoint is reached.
  580.     Addr specifies a RAM address or symbolic reference. If you use a symbolic 
  581.  reference, the code need not be in memory when you set the breakpoint.
  582.     Trap specifies a trap name or number. You must prefix a trap number with the 
  583.  trap character (†, or Option-T) and a trap name with an underscore character 
  584.  (_InitGraf, for example).
  585.     TrapRange specifies a range of traps. You must use the range operator (..) 
  586.  between trap names or numbers. 
  587.     BreakAction    Specifies a command or series of commands that is executed 
  588.  when the breakpoint is reached.
  589.     From addrRange indicates that a break is to occur only when the trap is 
  590.  called from the specified range.
  591.     All traps sets a breakpoint on every trap. 
  592.     You can set trap breakpoints on a single trap, a range of traps, or on all traps.  
  593.  In each case you can also specify a memory range so that  SADE breaks only when the 
  594.  trap is called from the specified range.
  595.     If you want to specify the same trap in multiple Break commands, use the List 
  596.  command to see what breakpoints have been set. When implementing trap 
  597.  breakpoints, SADE first looks for a Toolbox or Operating System call that matches a 
  598.  specified trap name, checking the address range if one was given. If no match is 
  599.  found, SADE then looks for trap ranges containing the trap. SADE takes the most 
  600.  recently defined range containing the trap, again checking the address range if one 
  601.  was specified.
  602.  
  603.      Note: If you set an address breakpoint on a trap call for which a trap breakpoint 
  604.  has already been set, the address breakpoint is recognized and the trap breakpoint  
  605.  is not.
  606.  
  607.     If you have specified a break action, SADE resumes program execution after 
  608.  executing your break-action commands. There are two ways to suspend program 
  609.  execution as part of a break action. The Abort command returns control to SADE 
  610.  immediately, canceling any pending commands. The Stop command executes any 
  611.  pending commands and then returns control to SADE.
  612.  
  613.     Warning: SADE saves the commands you specify in the break action and 
  614.  does not interpret them until reaching the breakpoint. Symbol references that may 
  615.  appear to be correct when you define the break action may be out of scope when the 
  616.  action is actually executed. So make sure that program symbol references are 
  617.  correctly interpreted at the time the breakpoint is reached. 
  618.  
  619.     Do not delete the breakpoint as part of a break action. SADE stores the break  
  620.  action with the breakpoint; if you remove the breakpoint, you throw away the  
  621.  break action as well — even though SADE is in the middle of executing it — so the  
  622.  action does not execute properly.
  623.  
  624.     Note: If no break action is specified and the execution command (Go, for 
  625.  instance) just prior to hitting a breakpoint is part of a structured statement  
  626.  (such as While...End), or if multiple commands were selected, the remaining commands  
  627.  are executed after hitting the breakpoint and re-entering SADE.
  628.  
  629.     You can specify multiple breakpoints, separated by commas, with a single 
  630.  Break command. If this command includes a break action at the end, the action is 
  631.  applied to all breaks in the list. 
  632.  
  633.  Examples    
  634.  
  635.  #-- This example shows breaks set on different traps, trap ranges, and traps called 
  636.  #-- from particular memory ranges.
  637.  
  638.  Break _GetResource
  639.  Break †$A997..†$A9A0
  640.  Break all traps from myproc.(1)..myproc.(5)
  641.  Break all traps from applZone..applZone^
  642.  
  643.  #-- The following example sets multiple breakpoints.
  644.  
  645.  Break procB.(1), _LineTo from procA.(1)..procA.(1000), _setPort Begin; "hit one"; end
  646.  
  647.  List break
  648.   procB.(1)   # $586398  # processID =5  # has break action
  649.   _LineTo  # processID =5  # †$A891  # called from procA.(1) .. procA.(83)  # has break action
  650.   _SetPort  # processID =5  # †$A873  # has break action
  651.  
  652.  #-- A break set on top of a matching breakpoint replaces the older one. Breakpoints match 
  653.  #-- if they are set on the same address or trap and the called from address range, if there 
  654.  #-- is one, matches. 
  655.  
  656. Break DoMenuCommand.(0)
  657. Break _LineTo
  658.  
  659. List Break
  660. Trap _SetPort (†$A873)
  661. Trap _LineTo (†$A891)
  662. DoMenuCommand.(0)
  663.  
  664. See also    Abort, List, Stop, Trace, Unbreak
  665. -
  666. Case —changes case sensitivity
  667.  Syntax    
  668.      Case on | off
  669.  
  670.  Description    
  671.      This command turns case sensitivity on and off. By default, case 
  672.  sensitivity is on, which means that when looking up symbols, SADE first performs a 
  673.  case-sensitive lookup. If the symbol isn’t found, SADE converts all the characters to 
  674.  uppercase and looks again. When case sensitivity is off, SADE converts all symbols to 
  675.  uppercase before any lookup, speeding up the search process.
  676.     Because symbols in C are case sensitive, C programmers must have case sensitivity 
  677.  turned on or SADE will not recognize any of the symbols in the program (except those 
  678.  that are all uppercase). Pascal programmers, however, may want to set case sensitivity 
  679.  off to speed up performance. Note however, that even with case set to on, SADE will 
  680.  find Pascal symbols (no matter what combination of uppercase and lowercase 
  681.  characters you enter) because if SADE cannot find a symbol in a case-sensitive 
  682.  search, it performs a second search after converting all characters to uppercase.
  683.  
  684.  Examples    
  685.  
  686.  #-- These examples illustrate how Case on and Case off work by showing 
  687.  #-- the output you get when typing symbols in different combinations of lowercase and 
  688.  #-- uppercase letters. 
  689.  
  690.  
  691.  #-- C programmers
  692.  Case on
  693.  
  694.  CFunction
  695.  
  696.  #-- output
  697.  CFunction.(0)
  698.  
  699.  CFUNCTION
  700.  
  701.  #-- output
  702.  ### Could not find "CFUNCTION" as a program symbol
  703.  
  704.  cfunction
  705.  
  706.  #-- output
  707.  ### Could not find "cfunction" as a program symbol
  708.  
  709.  Case off
  710.  
  711.  CFunction
  712.  
  713.  #-- output
  714.  ### Could not find "CFunction" as a program symbol
  715.  
  716.  
  717.  #-- Pascal programmers
  718.  Case on
  719.  
  720.  PascalProc
  721.  
  722.  #-- output
  723.  PASCALPROC.(0)
  724.  
  725.  PASCALPROC
  726.  
  727.  #-- output
  728.  PASCALPROC.(0)
  729.  
  730.  Case off
  731.  
  732.  PascalProc
  733.  
  734.  #-- output
  735.  PASCALPROC.(0)
  736. -
  737. Close —closes a file
  738.  Syntax    
  739.      Close [ all | windowName ]
  740.  
  741.  Description    
  742.      The Close command closes the specified file or all files. WindowName is the name 
  743.  of the window (file) to close. It is a string expression and you must enclose it 
  744.  in quotation marks if it’s a string constant. Specifying all closes all of the open
  745.  windows open in SADE.
  746.     If you don’t specify any parameters, Close closes the target window. Note, 
  747.  however, that the SADE Worksheet file cannot be closed. If the contents of a file have 
  748.  not been saved, a dialog box asks whether they should be.
  749.  
  750.  Examples
  751.  
  752.  Close 'myFile'
  753.  Close targetWindow   #no quotes needed--uses SADE variable targetWindow
  754. -
  755. Concat —concatenates strings
  756.  Syntax    
  757.      Concat ( [ string,…] )   
  758.  
  759.  Description
  760.      Concat returns the concatenation of the specified string expressions. If 
  761.  you supply nonstring arguments, Concat tries to coerce them to strings. If you  
  762.  specify no arguments, Concat returns a null string.
  763.  
  764.  Example
  765.  
  766.  pathName := 'root:examples:'
  767.  fileName := 'sample.c'
  768.  Open Concat(pathName,fileName)        # equivalent to open 'root:examples:sample.c'
  769. -
  770. Confirm —displays confirmation dialog box
  771.  Syntax    
  772.      Confirm ( message [, Boolean ] )   
  773.  
  774.  Description
  775.     Confirm presents a dialog box containing the specified message and 
  776.  either two or three buttons depending on the value you specify for Boolean. Confirm 
  777.  returns a number indicating the button that you press in the dialog box. 
  778.     If you omit the optional Boolean or specify 0, Confirm presents OK and Cancel 
  779.  buttons, and returns 1 or 0 respectively when you press them. If you specify a  
  780.  nonzero value for Boolean, Confirm presents Yes, No, and Cancel buttons, which   
  781.  return 1, 0, and –1 respectively when you press them.
  782.  
  783.  Example
  784.  
  785.  confirm('Are you sure?',1)
  786.  
  787.  See also    Request
  788. -
  789. Copy —copies string
  790.  Syntax    
  791.      Copy ( string, characterIndex, length )   
  792.  
  793.  Description    
  794.      Copy returns all or part of the specified string. Use characterIndex to indicate
  795.  the first character to copy; for example, to start with the third character of the
  796.  string, specify 3 (it’s 1-based). Use length to specify he length of the output 
  797.  string.
  798.  
  799.  Example
  800.  
  801.  #-- Strips the hard drive name off the directory path (because the 
  802.  #-- copy begins with the fifth character) and copies the rest of the  
  803.  #-- directory path to the pathName variable. You can then open a file  
  804.  #-- by concatenating pathName with a filename. This example specifies 255
  805.  #-- as a number for the length because it is large enough to accommodate
  806.  #-- long pathnames.
  807.  
  808.  directoryPath := 'root:examples:cexamples:'
  809.  pathName := copy(directoryPath,5,255)
  810.  Open Concat(pathName,'sample.c')
  811. -
  812. Cycle —continues execution within construct
  813.  Syntax    
  814.      Cycle  [ if  Boolean ]
  815.  
  816.  Description    
  817.      The Cycle command causes execution to continue from the conditional test
  818.  of a While, Repeat, or For construct, or from the beginning of a Loop construct. 
  819.  If a Boolean expression is specified, Cycle executes only if the Boolean 
  820.  expression (Boolean) evaluates to nonzero; otherwise execution continues immediately 
  821.  following the Cycle command.
  822.  
  823.  Example    
  824.  
  825.  Define testNum := 0
  826.  Define endNum := 6
  827.  Define cycleMax := 4
  828.  
  829.  Repeat
  830.     Printf "testNum = %d\n", testNum
  831.     testNum := testNum + 1
  832.     Cycle If testNum < cycleMax
  833.     "\nDidn't cycle"
  834.  Until testNum = endNum
  835.  
  836.  #-- output
  837.  
  838.  testNum = 0
  839.  testNum = 1
  840.  testNum = 2
  841.  testNum = 3
  842.  
  843.  Didn't cycle
  844.  testNum = 4
  845.  
  846.  Didn't cycle
  847.  testNum = 5
  848.  
  849.  Didn't cycle
  850.  
  851.  See also    Leave
  852. -
  853. Define —declares a SADE variable
  854.  Syntax    
  855.      Define [ global ] declaration [,...]
  856.         where declaration has the form
  857.     name [ [dimension] [ := initValue | = initValue  ] ]
  858.     
  859.  
  860.  Description    
  861.      The Define command defines one or more SADE variables. You must define a variable
  862.  before using it. The variable declaration identifies the name, scope, and 
  863.  (optionally) the initial value of the variable. Separate multiple declarations by 
  864.  commas. The name of the variable must be unique in the current scope unless 
  865.  you declare it global. The dimension is the size of the array if it is a structured 
  866.  variable. It is an expression enclosed in brackets. The initValue is an expression 
  867.  for the initial value of simple types, or for structured types a list of the 
  868.  following form:
  869.  
  870.     ( [ expr of ] initValue , ..)
  871.  
  872.  where the optional of clause allows for replication of a value.
  873.     SADE variables are dynamically typed; that is, their type is determined on 
  874.  assignment (and may be changed by new assignments). SADE variables defined as 
  875.  arrays require an index. SADE array variables may contain a heterogeneous set of 
  876.  values; that is, the elements may contain values of different types.
  877.     An initial value for simple types may optionally be specified by an expr following 
  878.  the assignment operator (:=) or, in this case only, (=). If the declared item is an 
  879.  array, a list of initial values may be specified as the values of the array elements.
  880.     The scope of a variable can be either global or local. If a variable is defined 
  881.  outside a procedure (or function), its scope is automatically global. In other words,  
  882.  it is known both inside and outside of any procedures. If a variable is declared 
  883.  inside a procedure, its scope is local unless you specify the global option. If a 
  884.  global and a local variable exist with the same name, the local symbol overrides 
  885.  the global symbol.
  886.     Redefining global variables replaces the previous definition, with one exception:  
  887.  If the definition is within a procedure, and the new definition matches the 
  888.  existing definition, then the existing definition is retained. For example, when a 
  889.  global variable is defined within a procedure or function and is given an initial 
  890.  value, the initialization occurs only when the variable is actually created. 
  891.  Subsequent invocations of the procedure do not affect the current value of the global 
  892.  variable, and can make use of the value left in the variable by the preceding 
  893.  invocation.
  894.     You cannot use the Define command within any structured statement. To remove a 
  895.  variable definition, use the Undefine command. 
  896.  
  897.  Examples    
  898.  
  899.  #-- Define a five element array, with the first four elements true and the last 
  900.  #-- element false.
  901.  
  902.  Define global test[5] := (4 of 1,0)
  903.  
  904.  #-- Define a 30 element array, with the first 29 elements true and the last 
  905.  #-- element false.
  906.  
  907.  Define arraysize := 30
  908.  Define myArray[arraysize] := (arraysize-1 of 1,0)
  909.  
  910.  #-- In the next example, note that the definition of index in RotateLeftOneWCarry() 
  911.  #-- is local to that procedure; otherwise it would be attempting to redefine the 
  912.  #-- global index that's used as a For loop counter when RotateLeftOneWCarry() 
  913.  #-- is called.
  914.  
  915.  Proc RotateLeftOneWCarry()
  916.     Define global SADEArray[4] := ("indexed by one", 2, 3.33, "fourth and last")
  917.     Define index
  918.     Define holder
  919.     For index := 1 to 4 do
  920.         If index = 1 then
  921.             holder := SADEArray[index]
  922.         else
  923.             SADEArray[index-1] := SADEArray[index]
  924.             If index = 4 then
  925.                 SADEArray[index] := holder
  926.             End
  927.         End
  928.     End
  929.  End
  930.  
  931.  Define index
  932.  Define holder
  933.  For index := 1 to 4 do
  934.     RotateLeftOneWCarry()
  935.     For holder := 1 to 4 do
  936.         SADEArray[holder]
  937.     End
  938.     Printf "\n"
  939.  End
  940.  Undefine RotateLeftOneWCarry
  941.  
  942.  #-- output
  943.  2
  944.  3.33
  945.  fourth and last
  946.  indexed by one
  947.  
  948.  3.33
  949.  fourth and last
  950.  indexed by one
  951.  2
  952.  
  953.  fourth and last
  954.  indexed by one
  955.  2
  956.  3.33
  957.  
  958.  indexed by one
  959.  2
  960.  3.33
  961.  fourth and last
  962.  
  963.  See also    Undefine
  964. -
  965. DeleteMenu —deletes menus or menu items
  966.  Syntax    
  967.      Deletemenu [ menuName [ itemName ] ]
  968.  
  969.  Description
  970.      The DeleteMenu command deletes menus and menu items. MenuName specifies the 
  971.  name of a user-defined bar menu. If you specify menuName but do not specify itemName, 
  972.  SADE deletes the entire menu. Because menuName is a string expression, you must 
  973.  enclose it in quotation marks if it is a string constant.
  974.     ItemName is an item in the bar menu that you specified with menuName. It is a 
  975.  string expression and you must enclose it in quotation marks if it is a string
  976.  constant.
  977.     You cannot delete the standard SADE menus and menu items (the Apple, File, Edit, 
  978.  Find, Mark, and Window menus).
  979.  
  980.     Warning: If you omit both menuName and itemName, SADE deletes all user-defined 
  981.  menus, that is, the SourceCmds and Variables menus (which are defined by commands 
  982.  in the SADEStartup file) and any menus that you have added in the SADEUserStartup
  983.  file. You can restore these menus by executing SADEStartup and SADEUserStartup.
  984.  
  985.  Example
  986.  
  987.  Deletemenu "Special" "Launchapp"
  988.  
  989.  See also    AddMenu
  990. -
  991. Directory —sets or writes the default directory
  992.  Syntax    
  993.      Directory  [ directoryName ]
  994.  
  995.  Description
  996.      The Directory command sets the default directory for all SADE file-oriented
  997.  operations to the specified directory. If you don’t specify directoryName SADE 
  998.  displays the current default directory. DirectoryName follows the same conventions 
  999.  as MPW, that is, you can specify a full or partial pathname. It is a string 
  1000.  expression and you must enclose it in quotation marks if it is a string constant.
  1001.     If a directory specification contains a colon but does not begin the with a colon,
  1002.  SADE reads it as a complete pathname.
  1003.  
  1004.  Examples
  1005.  
  1006.  #-- Change the current directory of HD:MPW to HD:MPW:Examples
  1007.  
  1008.  Directory 'Examples'
  1009.  
  1010.  #-- Change the current directory of HD:MPW to HD:MPW:Examples:CExamples. 
  1011.  #-- You can still specify a partial pathname, but you must precede the directory 
  1012.  #-- name with a colon.
  1013.  
  1014.  Directory ':Examples:CExamples'
  1015.  
  1016.  #-- Define a macro for your work directory
  1017.  
  1018.  Macro here "'HD:MPW:Example:CExample'"
  1019.  Directory here
  1020.  
  1021.  See also    Sourcepath
  1022. -
  1023. Disasm —disassembles code
  1024.  Syntax    
  1025.      Disasm  [ addr  [ count ] ]
  1026.         or
  1027.     Disasm  [ addrRange ]
  1028.  
  1029.  Description
  1030.      The Disasm command disassembles instructions starting at the location specified
  1031.  by addr or addrRange . The default behavior when no address is specified is to begin
  1032.  disassembling at the end of the last disassembly. If the value of the program 
  1033.  counter has changed since the last disassembly, the program counter (PC) is used as 
  1034.  the default starting address. If no range or count is specified, the number of 
  1035.  instructions (not lines) disassembled defaults to 20.
  1036.     AddrRange specifies the range of addresses for the disassembly. You specify a 
  1037.  starting and ending address separated by the range operator (..). See “Examples”.
  1038.     Each line of the disassembly output is divided into three fields: the address of 
  1039.  the instruction, the hexadecimal encoding for the instruction, and the assembly code 
  1040.  (opcode, operand, and comment). You can modify the presence, order, and format of 
  1041.  these fields by changing the value of the built-in variable DisAsmFormat. The 
  1042.  disassembly output also correlates source statement numbers with the assembly code 
  1043.  instructions (see the second example).
  1044.  
  1045.  Examples
  1046.  
  1047.  #-- Disassemble five instructions in standard format, starting at the fourth 
  1048.  #-- statement of the AdjustMenus routine.
  1049.  
  1050.  Disasm $23B5EE 5
  1051.  
  1052.  #-- output
  1053.  
  1054.  AdjustMenus.(4)
  1055.     0023B5EE  2F0B            MOVE.L         A3,-(A7)
  1056.     0023B5F0  7004            MOVEQ          #$04,D0
  1057.     0023B5F2  3F00            MOVE.W         D0,-(A7)
  1058.     0023B5F4  A939            _EnableItem                        ; A939
  1059.     0023B5F6  6008            BRA.S          AdjustMenus.(6)        ; 0023B600
  1060.  
  1061.  #-- Disassemble the instructions between the first and fourth statements of the 
  1062.  #-- AdjustMenus routine.
  1063.  
  1064.  Disasm AdjustMenus.(1)..AdjustMenus.(4) 
  1065.  
  1066.  #--output
  1067.  
  1068.  AdjustMenus.(1)
  1069.     0023B5D2  598F            SUBQ.L        #$4,A7
  1070.     0023B5D4  A924            _FrontWindow                        ; A924
  1071.     0023B5D6  285F            MOVEA.L        (A7)+,A4
  1072.  AdjustMenus.(2)
  1073.     0023B5D8  598F            SUBQ.L         #$4,A7
  1074.     0023B5DA  3F3C 0081       MOVE.W        #$0081,-(A7)
  1075.     0023B5DE  A949            _GetMHandle                        ; A949
  1076.     0023B5E0  265F            MOVEA.L        (A7)+,A3
  1077.  AdjustMenus.(3)
  1078.     0023B5E2  2F0C            MOVE.L        A4,-(A7)
  1079.     0023B5E4  4EBA 02FC       JSR            IsDAWindow.(0)        ; 0023B8E2
  1080.     0023B5E8  4A00            TST.B            D0
  1081.     0023B5EA  588F            ADDQ.L        #$4,A7
  1082.     0023B5EC  670A            BEQ.S            AdjustMenus.(5)        ; 0023B5F8
  1083.  AdjustMenus.(4)
  1084.     0023B5EE  2F0B            MOVE.L        A3,-(A7)
  1085.     0023B5F0  7004            MOVEQ            #$04,D0
  1086.     0023B5F2  3F00            MOVE.W        D0,-(A7)
  1087.     0023B5F4  A939            _EnableItem                        ; A939
  1088.  
  1089.  See also    Dump
  1090. -
  1091. Dump —displays memory
  1092.  Syntax    Dump  [ byte | word | long ] [ addr  [ count ] ]
  1093.     or
  1094.  Dump  [ byte | word | long ]  [ addrRange ]
  1095.  
  1096.  Description    
  1097.      The Dump command displays memory at the location specified by addr or addrRange. 
  1098.  If no parameter is given, the memory starting at the program counter is displayed.
  1099.  The memory is displayed in hexadecimal and ASCII characters according to the 
  1100.  specified format, which may be byte, word (two bytes), or long (four bytes). The 
  1101.  default format is word.
  1102.     Count specifies the number of bytes to dump. The default, if you do not specify 
  1103.  a count, is 16 bytes.
  1104.     AddrRange specifies the range of addresses for the dump. You specify a starting 
  1105.  and ending address separated by the range operator (..). See “Examples”.
  1106.     Remember that to dump the value of a variable myVar, you must specify Dump 
  1107.  @myVar (since Dump myVar would take myVar’s value and use it as an address).
  1108.  
  1109.  Examples    
  1110.  
  1111.  #-- Dump 16 bytes (the default if no count is specified) from the A5 register. 
  1112.  
  1113.  Dump byte A5 
  1114.  
  1115.  #-- output
  1116.  
  1117.  $00146A8E 00 14 68 74 FF FF FF FF  00 00 00 00 00 00 00 00  ..ht........
  1118.  
  1119.  #-- Dump 40 bytes from the A5 register and group the output in words.
  1120.  
  1121.  Dump word A5 40
  1122.  
  1123.  #-- output
  1124.  
  1125.  $00146A8E 0014 6874 FFFF FFFF  0000 0000 0000 0000  ..ht............
  1126.  $00146A9E 000E 6C66 0000 FFFF  FFFF FFFF FFFF FFFF  ..lf............
  1127.  $00146AAE 0001 4EF9 000E 6E00                       ..N...n.
  1128.  
  1129.  
  1130.  
  1131.  #-- Dumps 40 bytes from the A5 register and group the output in long words. 
  1132.  
  1133.  Dump long A5..A5+40
  1134.  
  1135.  #-- output
  1136.  
  1137.  $00146A8E 00146874 FFFFFFFF  00000000 00000000  ..ht............
  1138.  $00146A9E 000E6C66 0000FFFF  FFFFFFFF FFFFFFFF  ..lf............
  1139.  $00146AAE 00014EF9 000E6E00  00                 ..N...n..
  1140.  
  1141.  See also    Disasm
  1142. -
  1143. Eval —evaluates string as an expression
  1144.  Syntax    
  1145.      Eval (text, [ message ] )    
  1146.  
  1147.  Description
  1148.      Eval evaluates the text of a string argument as an expression. The function 
  1149.  result can be any type, depending on what the expression evaluates to. You can
  1150.  optionally supply a message; if an error occurs, Eval returns this message as the 
  1151.  function result. If you do not supply a message and an error occurs, Eval aborts 
  1152.  and reports the error.
  1153.  
  1154.  Example
  1155.  
  1156.  #-- Pass the name of a program variable (menuId) to a variable in SADE (theVar).
  1157.  #-- SADE uses the Printf command to print the name of the variable and Printf 
  1158.  #-- with Eval to print its value. If SADE cannot determine the value of the program 
  1159.  #-- variable (for example, because it is out of scope), Printf prints ??? (the 
  1160.  #-- message part of Eval). 
  1161.  
  1162.  theVar := menuId
  1163.  Printf "%t = %t\n", theVar, Eval(Concat('`', theVar), '???')
  1164.  
  1165.  #-- Note that this example uses Concat with the backquote character (`) to treat 
  1166.  #-- theVar as a program symbol. The code in this example is similar to code in the 
  1167.  #-- SADEStartup file that implements the Show Value menu item.
  1168. -
  1169. Execute —executes commands in a file
  1170.  Syntax    
  1171.      Execute filename
  1172.  
  1173.  Description
  1174.      The Execute command executes the commands and definitions contained in the 
  1175.  specified file. The Execute command can’t be used within a structured statement.
  1176.  Filename is the name of the file to execute. It is a string expression and must 
  1177.  be enclosed in quotation marks if it’s a string constant. 
  1178.  
  1179.  Example
  1180.  
  1181.  #--In this example, the Redirect command creates a file to hold output from SADE. 
  1182.  #-- Entering a string echoes the string. That output is redirected to the file, 
  1183.  #-- becoming the file’s contents. Here the string is a comment and a SADE command 
  1184.  #-- to execute the contents of the next file in the chain.
  1185.  
  1186.  Open 'exec1'
  1187.  Redirect 'exec1'
  1188.  
  1189.     '"\n executing exec1 now"'
  1190.     "execute 'exec2'"
  1191.  
  1192.     Open "exec2"
  1193.     Redirect 'exec2'
  1194.         "'now executing exec2'"
  1195.         "execute 'exec3'"
  1196.  
  1197.         Open "exec3"
  1198.         Redirect 'exec3'
  1199.             '"Done in exec3"'
  1200.  
  1201.  Redirect pop all
  1202.  Execute "exec1"
  1203.  
  1204.  Alert "Try a tile windows here\n∂
  1205.     Then look at the worksheet for output"
  1206.  
  1207.  #-- output
  1208.  
  1209.  executing exec1 now
  1210.  now executing exec2
  1211.  Done in exec3
  1212. -
  1213. Find —searches for a target
  1214.  Syntax    
  1215.      Find [ count ] pattern [ ,n ] [ addrRange [ mask mask ] ] 
  1216.         or
  1217.     Find [ count ] pattern [ ,n ]  [ addr [ count ] [ mask mask ] ]
  1218.         or
  1219.     Find [ same  [ addrRange ] | [ addr  [ count ] ] ]
  1220.  
  1221.  Description
  1222.      The Find command searches memory for a specified pattern, which can be either
  1223.  a numeric or string expression. If you specify the count keyword, Find tells you how
  1224.  many occurrences of the target it found. If you omit the count keyword, Find displays
  1225.  the address of the first occurrence of the pattern. You can use the n parameter to 
  1226.  specify which occurrence of the pattern you want; for instance, if you specify 
  1227.  3 for n, Find returns the address of the third occurrence of the pattern.
  1228.     If the keyword count is specified, Find returns the number of occurrences of the 
  1229.  target string it has found. If you omit it, Find displays the address of the first 
  1230.  occurrence of the target string. An integer n indicates which occurrence of the 
  1231.  target pattern you want; for example, if you specify 3, SADE displays the address of 
  1232.  the third occurrence of the pattern. Note that you must precede this number with a 
  1233.  comma.
  1234.     AddrRange is the address range in which to limit the search. If you do not specify 
  1235.  a range of addresses (or a starting address), the search range is the MultiFinder  
  1236.  block containing the application’s heap and stack (in other words, all of the memory 
  1237.  that belongs to the application).
  1238.     Addr is an address at which to begin the search. You can also specify count, the
  1239.  number of bytes to search beyond the specified address; otherwise the search goes 
  1240.  from the starting address to the end of memory. If you do not specify a starting 
  1241.  address or range of addresses, the search range is the MultiFinder block containing 
  1242.  the application’s heap and stack (in other words, all of the memory that belongs to 
  1243.  the application).
  1244.     The mask parameter (prefaces by the mask keyword) is an optional numeric or
  1245.  string expression that is logically ANDed with the contents of each memory location 
  1246.  before the search comparison is done.
  1247.     The same keyword instructs Find to search for the next occurrence of the same
  1248.  target pattern as specified in the last Find command. You can optionally specify 
  1249.  a different address range or starting address and number of bytes for the search. 
  1250.  If you used the count keyword in the previous Find command, you cannot use same in 
  1251.  the next one; if you do so, SADE returns a message that the pattern cannot be found. 
  1252.     Important: Remember that expression values in SADE are long words by default;
  1253.  to specify another size, use typecasting, as shown below.
  1254.  
  1255.  Examples
  1256.  
  1257.  Dump $20 $40
  1258.  $00000020 0027 A002 0027 A00A  0040 1F52 0027 A012  .'...'...@.R.'..
  1259.  $00000030 0027 A01A 0027 A032  0040 113C 0027 A02A  .'...'.2.@.<.'.*
  1260.  $00000040 0040 113C 0040 113C  0040 113C 0040 113C  .@.<.@.<.@.<.@.<
  1261.  $00000050 0040 113C 0040 113C  0040 113C 0040 113C  .@.<.@.<.@.<.@.<
  1262.  
  1263.  #-- Search $40 bytes for the number of occurrences of the string, $113C,  
  1264.  #-- starting at address $20. The string has been cast to word size; otherwise
  1265.  #-- the default search would be for a long word and nothing in the range
  1266.  #-- matches $0000113C. The search finds nine occurrences of the string.
  1267.  
  1268.  Find COUNT (word)$113C $20 $40
  1269.  9
  1270.  
  1271.  #-- Search the range $20 to $96 for the string $113C and display the address
  1272.  #-- of the first occurrence of this string. The search string has been typecast 
  1273.  #-- to word size using C style casting.
  1274.  
  1275.  Find (word)$113C $20..$96
  1276.  $0000003A
  1277.  
  1278.  #-- Search $40 bytes beginning at address $20 for the string $113C and display 
  1279.  #-- the address of the second occurrence of this string. The search string has 
  1280.  #-- been typecast to word size using Pascal style casting.
  1281.  
  1282.  Find word($113C), 2 $20 $40
  1283.  $00000042
  1284.  
  1285.  #-- Search the range $20 to $96 for the string $0000113C and display the address
  1286.  #-- of the first occurrence of this string. A mask has been used
  1287.  
  1288.  Find $0000113C $20..$96 MASK $0000ffff
  1289.  $00000038
  1290.  
  1291.  #-- Find the same target string as the last example, except the memory 
  1292.  #-- range has been changed.
  1293.  
  1294.  Find SAME $40..$50
  1295.  $00000040
  1296. -
  1297. For ...End —loops with a control variable
  1298.  Syntax    
  1299.      For clause [ do ]
  1300.         commands
  1301.     End 
  1302.         where clause may have one of the following forms:
  1303.     var := expr to expr
  1304.     var  := expr downto expr
  1305.     var := expr , ...
  1306.  
  1307.  Description
  1308.      The For...End construct provides looping with a control variable. The enclosed
  1309.  commands are executed until the control variable has taken on each successive
  1310.  value in the range expressed by clause.
  1311.     You must declare the control variable var before using it, and you cannot specify 
  1312.  an array variable. For the clause expr to expr, the commands are executed and the 
  1313.  control value (var) is incremented once for each integer value in the range. For the
  1314.  clause expr downto expr, the control value is decremented. The third clause is a
  1315.  list of expressions; the commands are executed until the control variable has taken 
  1316.  on the value of each of the listed expressions.
  1317.     You can nest For...End constructs; you may also use them within other flow-
  1318. control constructs, as well as in break actions. The control variable may be modified 
  1319. within the body of the loop (but cannot, of course, be shared between nested 
  1320. constructs).
  1321.  
  1322.  Example
  1323.  
  1324.  Define var := 0
  1325.  Define outerLooper, syncopation
  1326.  For outerLooper := 3 downto 1 do
  1327.     "\n"
  1328.     For syncopation := "one","two","three", var
  1329.         Printf "%d -- " , outerLooper
  1330.         syncopation
  1331.         var := var + 1
  1332.     End
  1333.  End
  1334.  
  1335.  #-- output
  1336.  
  1337.  3 -- one
  1338.  3 -- two
  1339.  3 -- three
  1340.  3 -- 0
  1341.  
  1342.  2 -- one
  1343.  2 -- two
  1344.  2 -- three
  1345.  2 -- 4
  1346.  
  1347.  1 -- one
  1348.  1 -- two
  1349.  1 -- three
  1350.  1 -- 8
  1351. -
  1352. Func ...End —defines a SADE function
  1353.  Syntax    
  1354.      Func  name  [ ( argName ,... ) ]
  1355.         commands
  1356.     End
  1357.  
  1358.  Description
  1359.      SADE functions are delimited by the Func...End construct. The last statement to
  1360.  be executed must be a Return command specifying a return value. The type of a
  1361.  function is not specified in the definition but rather takes on the type of the 
  1362.  value returned. (Thus functions are not limited to returning results of a single 
  1363.  type.)
  1364.     SADE functions use conventional calling notation, with the function name 
  1365.  followed by a list of parameters enclosed by parentheses. Function parameters are 
  1366.  handled in the same fashion as procedure parameters, and the predefined SADE 
  1367.  variables Arg and NArgs may be used. (See the description of the Proc command for 
  1368.  an example using these variables.)  User-defined functions may be called anywhere 
  1369.  an expression is allowed.
  1370.  
  1371.  Example
  1372.  
  1373.  #-- This function factors a number and displays the total.
  1374.  
  1375.  Func fact(n)
  1376.     If n <= 1.0 then
  1377.         Return 1.0
  1378.     else
  1379.         Return n * fact(n-1)
  1380.     End
  1381.  End
  1382.  
  1383.  See also    Proc, Return
  1384. -
  1385. Go —resumes execution
  1386.  Syntax    
  1387.      Go [ til addr ,...] [ onEntry commands ]
  1388.  
  1389.  Description
  1390.      The Go command resumes program execution at the current program counter. 
  1391.     If you specify the keyword til, SADE sets a temporary breakpoint at the specified 
  1392.  address(es). When the breakpoint is encountered, SADE is reentered and the breakpoint
  1393.  is removed. Note that if you specify multiple breakpoints with the keyword til, SADE
  1394.  removes all breakpoints when any of them is reached. If the address is in ROM, SADE
  1395.  informs you that it can’t set a breakpoint in ROM. 
  1396.     Use onEntry to specify an action to occur when SADE is reentered following 
  1397.  resumption of the program—for example, to display the value of a variable. If you do 
  1398.  not use onEntry but execute the Go command as part of a group of commands (in a 
  1399.  script file or highlighted in the Worksheet) SADE evaluates the other commands first 
  1400.  before executing Go regardless of the order in which you place the commands in the 
  1401.  script or in the Worksheet. 
  1402.     Important: You cannot execute a Step command following Go in a script or as 
  1403.  part of a highlighted group of commands unless you use the onEntry keyword. With 
  1404.  onEntry you can tell SADE to execute a Step command after returning to SADE 
  1405.  following the Go command. (See the last example.)
  1406.  
  1407.  Examples
  1408.  
  1409.  #-- The first example resumes operation of the program and breaks at 
  1410.  #-- \OtherCompilationUnit.myProc.(1).
  1411.  
  1412.  Go til \OtherCompilationUnit.myProc.(1)
  1413.  
  1414.  
  1415.  #-- Assume that the program is suspended and a breakpoint has been set within the 
  1416.  #-- procedure that initializes the values of the variables gstopped and newstopped. 
  1417.  #-- The following code fragment resumes program execution, stops at the breakpoint, 
  1418.  #-- and displays the values of gstopped and newstopped.
  1419.  
  1420.  Go onEntry Begin
  1421.     Printf "gStopped is %d\n",gStopped
  1422.     Printf "newStopped is %d\n",newStopped
  1423.  end
  1424.  
  1425.  See also    Step, Stop
  1426. -
  1427. Heap —displays, checks or totals heap information 
  1428.  Syntax    
  1429.     Heap [ display ] [ addr ] [  blocktype  ]
  1430.     Heap check [ addr ]
  1431.     Heap totals [ addr ] [ blocktype ]
  1432.     
  1433.  Heap Display Description
  1434.     The Heap command displays information about the specified heap. Display is the 
  1435.  default if you don’t specify any options, so you can omit it if you wish.
  1436.  Addr specifies the beginning address of a heap. If you omit this parameter, 
  1437.  Heap displays information about the heap pointed to by the global variable theZone.
  1438.  By default, the following information is displayed:
  1439.     •    a dot if the object is locked or nonrelocatable
  1440.     •    the address of the beginning of the block and the block length
  1441.     •    the block type: H=relocatable, P=nonrelocatable, F=free
  1442.     •    the address of the master pointer if it’s a relocatable block
  1443.     •    block attributes (Flags): L=locked, R=resource, P=purgeable
  1444.     •    for standard toolbox data structures, a description of the structure
  1445.     •    for a resource, the resource type and ID, the reference number of the 
  1446.         file it’s in, and the resource name
  1447.     You can specify one of the following blocktypes to limit the display to a 
  1448.  particular type of block:
  1449.     •    purge[able] - limits the display to purgeable blocks.
  1450.     •    nonreloc[atable] - limits the display to nonrelocatable blocks. 
  1451.     •    reloc[atable] - limits the display to relocatable blocks.
  1452.     •    free - limits the display to free blocks. 
  1453.     •    lock[ed] - limits the display to locked  blocks. 
  1454.     •    res[ource] - limits the display to resources.
  1455.     •    restype 'type' - limits the display to the specified resource type. 
  1456.     Note that the resource type is case-sensitive and you must enclose it in single 
  1457.  quotation marks ('MENU', for example).
  1458.  
  1459.  Example
  1460.  
  1461.  #-- Display heap information for 'MENU' type resources.
  1462.  Heap restype 'MENU'
  1463.  
  1464.  #-- output
  1465.  BlkAddr    BlkLength Typ MasterPtr  Flags RType   RId RFRef  RName
  1466.  $00316590  $00000098  H  $0031452C    R   MENU   1000 $0584  "File"
  1467.  $00316838  $00000050  H  $00314528    R   MENU   1001 $0584  "Edit"
  1468.  $00316888  $000000F4  H  $00314524    R   MENU   1002 $0584  "Log"
  1469.  
  1470.  
  1471.  Heap Check Description    
  1472.      The Heap check command checks the consistency of the current application heap,
  1473.  which is by default the heap referenced by the global variable theZone. If you
  1474.  specify addr -the address of another heap zone- it must be the address of the heap
  1475.  zone header (you can’t check part of a heap).
  1476.     Heap check performs range checking to make sure all pointers are even and 
  1477.  non-NIL, and that block sizes are within the range of the heap. It verifies that 
  1478.  the self-relative handle points to a master pointer referring to the same block. For
  1479.  nonrelocatable blocks, it checks if the heap zone pointer points to the zone where 
  1480.  the block exists. Heap check also verifies that the total amount of free space is 
  1481.  equal to the amount specified in the header, and that all pointers in the free 
  1482.  master pointer list are in the heap. 
  1483.  
  1484.  Examples    
  1485.  
  1486.  #-- This example intersperses Printf commands with Heap check commands to show at 
  1487.  #-- which memory locations the heap is okay.
  1488.  Printf "Checking %P's heap at $%.08X\n", ^Pstring( $910)^, TheZone
  1489.  Heap check TheZone
  1490.  
  1491.  Printf "Checking the System heap at $%.08x\n", SysZone
  1492.  Heap check SysZone
  1493.  
  1494.  Printf "Checking the MultiFinder heap at $%.8x\n", **$2a6+$c
  1495.  Heap check $2a6^^+$c
  1496.  
  1497.  #-- output
  1498.  Checking SADE's heap at $00146EF2
  1499.     The heap is okay.
  1500.  Checking the System heap at $00001400
  1501.     The heap is okay.
  1502.  Checking the MultiFinder heap at $00023d64
  1503.     The heap is okay.
  1504.  
  1505.  
  1506.  Heap Totals Description
  1507.      The Heap totals command summarizes the state of the current application heap,
  1508.  which is by default the heap referenced by the global variable theZone. You can 
  1509.  specify another heap that starts at addr, the beginning address of a heap.
  1510.     Information is given for free, nonrelocatable, and relocatable objects. If you 
  1511.  wish to restrict the display to a particular type of block, use the blocktype 
  1512.  parameter. You can specify one of the following blocktypes to limit the display 
  1513.  to a particular type of block:
  1514.     •    purge[able] - limits the display to purgeable blocks.
  1515.     •    nonreloc[atable] - limits the display to nonrelocatable blocks. 
  1516.     •    reloc[atable] - limits the display to relocatable blocks.
  1517.     •    free - limits the display to free blocks. 
  1518.     •    lock[ed] - limits the display to locked blocks. 
  1519.     •    res[ource] - limits the display to resources.
  1520.     •    restype 'type' - limits the display to the specified resource type.
  1521.     Note that type is case-sensitive and you must enclose it in single quotation
  1522.  marks ('MENU', for example).
  1523.  
  1524.  Example
  1525.  
  1526.  Heap totals
  1527.  
  1528.  #-- output
  1529.                           Total Blks  Total Size
  1530.  Free                             23       49080
  1531.  Nonrelocatable                    7        1348
  1532.  Relocatable                      89       21232
  1533.    Locked & NonPurgeable           2        5796
  1534.    Locked & Purgeable              2        8136
  1535.    UnLocked & Purgeable            6         680
  1536.    UnLocked & NonPurgeable        79        6620
  1537.  Heap (total)                    119       71660
  1538. -
  1539. Help —displays help information
  1540.  Syntax    
  1541.      Help [ identifier ,… ]
  1542.  
  1543.  Description
  1544.      The Help command displays information about using SADE, including the syntax 
  1545.  of all SADE commands. To see what values identifier can have, just enter Help.
  1546. -
  1547. If ...End —conditionally executes commands
  1548.  Syntax    
  1549.      If  Boolean  [ then ]
  1550.         commands
  1551.     [ elseif Boolean   [ then ]
  1552.         commands ] ...
  1553.     [ else
  1554.         commands ]
  1555.     End
  1556.  
  1557.  Description
  1558.      The If...End construct allows for conditional execution of sequences of SADE 
  1559.  commands. Each If must be concluded by a corresponding End. Although elseif and 
  1560.  else are optional, they must appear between the If and End in the order indicated 
  1561.  in the syntax description. You can use more than one elseif but at most one else.
  1562.     The commands controlled by an If extend to the corresponding End, or to the 
  1563.  first corresponding elseif or else. The commands controlled by an elseif extend to the 
  1564.  next corresponding elseif, else, or end. The commands controlled by an else extend to 
  1565.  the corresponding End.
  1566.     When an If...End construct is evaluated, if the If Boolean is true, the statements 
  1567.  controlled by the If are executed and the remainder of the construct to the End 
  1568.  keyword is skipped. If the Boolean is false, the statements controlled by the If 
  1569.  are skipped and the next (elseif) condition is checked, if present. If an elseif 
  1570.  condition is evaluated and is true, the commands it controls are executed and the 
  1571.  remainder of the construct is skipped. If no conditions are evaluated as true, when 
  1572.  the else command is reached (if present), the commands controlled by the else are 
  1573.  executed (otherwise, they’re skipped).
  1574.     You can nest If...End constructs.
  1575.  
  1576.  Example
  1577.  
  1578.  #-- Step through a five element array using a low to high index, looking for 
  1579.  #-- the first true element, and resetting it to false. The first four elements 
  1580.  #-- are true and the last one is false.
  1581.  
  1582.  Define global Test[5] := (4 of 1,0)
  1583.  
  1584.  Proc IfDemo
  1585.     Define WhichTest
  1586.     Define ShowMe
  1587.     For WhichTest:= 1 to 5 do
  1588.         Printf "\n"
  1589.         For ShowMe:= 1 to 5 do
  1590.             Printf "%t", test[showMe]
  1591.         End
  1592.         Printf " - "
  1593.         if Test[1]
  1594.             "Test[1] true"
  1595.         elseif Test[2]
  1596.             "Test[2] true"
  1597.         elseif Test[3]
  1598.             "Test[3] true"
  1599.         elseif Test[4]
  1600.             "Test[4] true"
  1601.         elseif Test[5]
  1602.             "Test[5] true"
  1603.         else
  1604.             "all tests false"
  1605.         End
  1606.         Test[ShowMe] := 0
  1607.     End
  1608.  End
  1609.  
  1610.  IfDemo
  1611.  
  1612.  #-- output
  1613.  
  1614.  11110 - test[1] true
  1615.  
  1616.  01110 - test[2] true
  1617.  
  1618.  00110 - test[3] true
  1619.  
  1620.  00010 - test[4] true
  1621.  
  1622.  00000 - all tests false
  1623.  
  1624.  #-- This example shows a SADE procedure that steps until the menuItem variable 
  1625.  #-- is false.
  1626.  
  1627.  Proc StepWhile
  1628.     If menuItem =  1
  1629.         Step onEntry StepWhile
  1630.     Else
  1631.         Stop
  1632.     End
  1633.  End
  1634.  
  1635.  Step onEntry StepWhile
  1636. -
  1637. Kill —terminates an application
  1638.  Syntax    
  1639.      Kill  [ filename  ]
  1640.  
  1641.  Description
  1642.      If you want to terminate an application, (whether it’s suspended or not), use the 
  1643.  Kill command. Be aware, though, that Kill is dangerous, since it doesn't give the 
  1644.  unlucky application a chance to perform its usual exit routines (like saving data). 
  1645.  Kill does perform cleanup activities like freeing the MultiFinder memory occupied by 
  1646.  the application and removing its trap patches.
  1647.     Filename specifies the name of the application or tool to terminate. It is a 
  1648.  string expression and you must enclose it in quotation marks if it’s a string 
  1649.  constant. The filename parameter is optional; if you omit it, SADE simply terminates 
  1650.  the current target application.
  1651.     If you are debugging an MPW Tool, the MPW Shell, not the tool itself, is SADE’s 
  1652.  target. Therefore, if you want to kill a tool that is targeted but leave MPW running, 
  1653.  you cannot use the Kill command. For this purpose, SADE provides a procedure named 
  1654.  KillTool; that suspends the execution of a tool but leaves MPW running. The KillTool 
  1655.  procedure is defined in the SADEStartup script, so it is always available. To use the 
  1656.  procedure, simply execute the command KillTool from the Worksheet window. You can 
  1657.  also kill a tool but leave MPW running by choosing the Kill menu command from the 
  1658.  File menu. If a tool is being debugged when the Kill menu item is chosen, SADE 
  1659.  calls KillTool.
  1660.  
  1661.  Examples
  1662.  
  1663.  #-- Terminate execution of the current target.
  1664.  Kill
  1665.  
  1666.  #-- Define a variable, ExPath that specifies the path to the Sample application. Kill
  1667.  #-- terminates Sample by using Concat to concatenate the directory path with the 
  1668.  #-- application name.
  1669.  Define ExPath := "Volume1:CExamples:"
  1670.  Kill Concat(ExPath, "Sample")
  1671. -
  1672. Leave —exits from a looping construct
  1673.  Syntax    
  1674.      Leave  [ if  Boolean ]
  1675.  
  1676.  Description
  1677.      The Leave command lets you exit from a Loop, While, Repeat, or For construct. You 
  1678.  can specify a condition for leaving with the if parameter. If the expression 
  1679.  specified by Boolean evaluates to true, then you exit the loop, otherwise continue to 
  1680.  repeat the commands in the loop. 
  1681.  
  1682.  Example
  1683.  
  1684.  #-- Increment the variable testNum each time through the loop. Exit the loop
  1685.  #-- when testNum reaches 3.
  1686.  
  1687.  Define testNum := 0
  1688.  Repeat
  1689.     Printf "testNum = %d\n", TestNum
  1690.     Leave if testNum = 3
  1691.     testNum := testNum + 1
  1692.  Until testNum = 6
  1693.  Printf "after leaving Repeat loop - testNum = %d\n", testNum
  1694.  
  1695.  #-- output
  1696.  
  1697.  testNum = 0
  1698.  testNum = 1
  1699.  testNum = 2
  1700.  testNum = 3
  1701.  
  1702.  after leaving Repeat loop - testNum = 3
  1703.  
  1704.  See also    Cycle, For, Loop, Repeat, While
  1705. -
  1706. Length —returns length of a string
  1707.  Syntax    
  1708.      Length ( string )   
  1709.  
  1710.  Description
  1711.      Length returns the length in bytes of the specified string.
  1712.  
  1713.  See also    SizeOf
  1714. -
  1715. List —lists processes, tracepoints, and breakpoints
  1716.  Syntax    
  1717.      List process
  1718.         or
  1719.     List trace  [ traps | addrs ]
  1720.         or
  1721.     List break  [ traps | addrs ]
  1722.  
  1723.  Description
  1724.      The List command shows the active processes, breakpoints, and tracepoints. 
  1725.     For processes, the display includes the following information: a process 
  1726.  number, a creator, and the filename for the process.
  1727.     For breakpoints and tracepoints, List displays the location along with its 
  1728.  symbolic representation. The optional traps or addrs keywords limit the 
  1729.  display to trap or address breakpoints (or tracepoints) respectively.
  1730.  
  1731.  Examples
  1732.  
  1733.  #-- List the breakpoints that have been set and the active processes.
  1734.  
  1735.  List break         # list all breakpoints set
  1736.  
  1737.  #-- output
  1738.     EVENTLOOP.(5)    <has break action>
  1739.     EVENTLOOP.(11)   
  1740.     EVENTLOOP.(2)    
  1741.  
  1742.  List Process
  1743.  
  1744.  #-- output
  1745.  Process#, creator, FileName
  1746.        2, 'MACS', 'Finder'
  1747.        3, 'MSWD', 'Microsoft Word'
  1748.        4, 'sade', 'Sade'
  1749.        5, 'MPNT', 'MacPaint'
  1750.      s 7, '????', 'Sample1'
  1751.  
  1752.  See also    Trace, Break
  1753. -
  1754. Loop ...End —repeats commands until Leave
  1755.  Syntax    
  1756.      Loop
  1757.         commands
  1758.      End
  1759.  
  1760.  Description
  1761.      The Loop...End construct provides unconditional looping. The enclosed commands
  1762.  are executed repeatedly. To exit the loop, use the Leave command.
  1763.     You can nest Loop constructs.
  1764.  
  1765.  Example
  1766.  
  1767.  Define Inner := 0
  1768.  Define Outer := 0
  1769.  Loop
  1770.     Loop
  1771.         Inner := Inner + 1
  1772.         Printf "Inner: %d " , Inner
  1773.         Leave if Inner > Outer
  1774.     End
  1775.     Inner := 0
  1776.     Outer := Outer + 1
  1777.     printf "Outer: %d\n", Outer
  1778.     leave if Outer > 4
  1779.  End
  1780.  
  1781.  #-- output
  1782.  Inner: 1 Outer: 1
  1783.  Inner: 1 Inner: 2 Outer: 2
  1784.  Inner: 1 Inner: 2 Inner: 3 Outer: 3
  1785.  Inner: 1 Inner: 2 Inner: 3 Inner: 4 Outer: 4
  1786.  Inner: 1 Inner: 2 Inner: 3 Inner: 4 Inner: 5 Outer: 5
  1787.  
  1788.  See also    Leave
  1789. -
  1790. Macro —defines a macro
  1791.  Syntax    
  1792.      Macro name  string-expr
  1793.  
  1794.  Description
  1795.      The Macro command associates a string of characters with a name. Macros allow you 
  1796.  to define short, familiar names to use instead of long, unfamiliar strings. For 
  1797.  instance, the SADEStartup file defines macros that let you use MacsBug-like syntax 
  1798.  for certain SADE commands. 
  1799.     String-expr    specifies the string of characters to associate with the macro. You 
  1800.  must enclose it in quotation marks. If you specify a string constant (such as a 
  1801.  directory name) you must enclose it in two sets of quotation marks.
  1802.     Macro definitions can be nested; that is, they can contain references to other 
  1803.  macros. Macro definitions cannot be recursive, however; in other words, a macro 
  1804.  definition can’t reference itself. Macro definitions are not allowed in structured 
  1805.  statements. Macros may be redefined. Macro definitions are limited to a length of 254 
  1806.  characters. 
  1807.  
  1808.  Examples
  1809.  
  1810.  Macro br 'break'
  1811.  Macro clr  'Unbreak all'
  1812.  
  1813.  Macro dir "'volume:very:long:directory:path'"
  1814.  directory dir
  1815. -
  1816. MoveWindow —moves window to location
  1817.  Syntax    
  1818.      MoveWindow  [ to h,v ] [window  ]
  1819.  
  1820.  Description
  1821.      Moves the upper-left corner of the specified window to the specified location. 
  1822.  The coordinates (0,0) are located at the left side of the screen at the bottom of the 
  1823.  menu bar. If the location specified would place the window’s title bar entirely off 
  1824.  the visible screen, an error is returned. If you do not specify a window SADE 
  1825.  assumes the target window (the second window from the front). If you do not specify 
  1826.  a location, SADE returns the window’s location without any effect on the window.
  1827.     The keyword To is followed by the horizontal and vertical coordinates (in 
  1828.  pixels) of the new location in that order. They are nonnegative integers. Separate 
  1829.  them by a comma.
  1830.  
  1831.  Examples    
  1832.  
  1833.  #-- Move the target window’s upper-left corner to a point approximately one inch 
  1834.  #-- in from the upper-left corner of the screen, and one inch below the bottom of 
  1835.  #-- the menu bar. (There are about 72 pixels per inch on the Macintosh display 
  1836.  #-- screen.)
  1837.  
  1838.  MoveWindow to 72, 72
  1839.  
  1840.  #-- The next example returns the location of the target window, which would be 
  1841.  #-- 72, 72 when executed after the command in the first example.
  1842.  
  1843.  MoveWindow
  1844.  
  1845.  # output-
  1846.  # MOVEWINDOW 72 72
  1847.  
  1848.  See also    SizeWindow, WindowSize
  1849. -
  1850. NaN —not a number
  1851.  Syntax    
  1852.      NaN ( expression )   
  1853.  
  1854.  Description
  1855.      NaN converts the specified expression into a SANE 10-byte extended value.
  1856. -
  1857. OnEntry —sets commands for SADE entry
  1858.  Syntax    
  1859.      OnEntry [ exception-action ] 
  1860.  
  1861.  Description
  1862.      The OnEntry command supplies commands that are to be executed each time SADE is 
  1863.  entered. Each OnEntry command replaces the commands specified by the previous 
  1864.  OnEntry command. In the SADEStartup file, the StandardEntry procedure is specified 
  1865.  as an OnEntry exception action. You can define your own OnEntry actions in the 
  1866.  SADEUserStartup file, but you’ll probably want to use the one in SADEStartup 
  1867.  as a model (so as not to lose the operations it performs). 
  1868.     Because the OnEntry command accepts only one command or procedure invocation, if 
  1869.  you want to execute multiple commands and/or procedures upon entry, use the 
  1870.  Begin..End construct to group them.
  1871.  
  1872.  See also    Break, Begin
  1873. -
  1874. Open —opens a file
  1875.  Syntax    
  1876.      Open [ source ]  [ behind ]  filename 
  1877.  
  1878.  Description
  1879.      The Open command opens the specified file. Specifying source opens the file as 
  1880.  read-only. If this option is omitted, the window is opened as a read-write window.
  1881.  Specifying behind opens the window behind the front most SADE window; otherwise, 
  1882.  it’s opened as the front most window.
  1883.     If the file is in the current directory, you can specify the name only; otherwise,
  1884.  specify a complete or partial directory name as well as the filename. The file must 
  1885.  be of type 'TEXT' or SADE will be unable to open it. Filename is a string expression
  1886.  and must be enclosed in quotation marks if it’s a string constant. 
  1887.  
  1888.  Example
  1889.  
  1890.  Open source 'myFile'
  1891.  
  1892.  See also    Close, Save
  1893. -
  1894. Printf —prints formatted output
  1895.  Syntax    
  1896.      Printf  [ format [ , argument ] … ]
  1897.         or
  1898.     Printf  [ ( format [ , argument ] … ) ]
  1899.  
  1900.  Description
  1901.      The Printf command prints string characters to a SADE window or file. You can 
  1902.  also use Printf to convert values—for example, convert decimal characters to 
  1903.  hexadecimal—and to specify how the output appears. Format is a string containing 
  1904.  characters to print, as well as format specifications for arguments that follow. 
  1905.  Format specifications are preceded by the % character. For instance, to print 
  1906.  the value of the variable myVar as a decimal number along with a message (assuming 
  1907.  its value is 5), enter:
  1908.     
  1909.     Printf "The value of myVar is %d", myVar
  1910.  
  1911.  #-- output
  1912.  The value of myVar is 5
  1913.  
  1914.     Remember that the format specification is a string so you must enclose it, 
  1915.  including the percent sign, in quotation marks.
  1916.     Argument is the value to be printed; it can be an actual numeric value or a 
  1917.  variable whose value you want to print. Each format specification applies to zero 
  1918.  or more arguments. When the format specifications are exhausted, any remaining 
  1919.  arguments are ignored. Likewise, when the specified arguments are exhausted, any 
  1920.  remaining format specifications are ignored.
  1921.  
  1922.  Examples
  1923.  
  1924.  #-- Displays record definition of system type EventRecord.
  1925.  #-- Notice how EventRecord.Where, which is of type Point, has been
  1926.  #-- expanded to show its definition too.
  1927.  
  1928.  Printf "%P", ^pstring($910)^
  1929.  myProg
  1930.  
  1931.  Printf "%P", *(pstring*) $910
  1932.  myProg
  1933.  
  1934.  Printf "%-t", EventRecord
  1935.  RECORD
  1936.    WHAT: Word;
  1937.    MESSAGE: Long;
  1938.    WHEN: Long;
  1939.    WHERE: RECORD
  1940.             CASE Word OF
  1941.               (1):
  1942.                 (RECORD
  1943.                    V: Word;
  1944.                    H: Word;
  1945.                  END);
  1946.   
  1947.               (2):
  1948.                 (RECORD
  1949.                    VH: ARRAY [(0, 1)] OF
  1950.                          Word;
  1951.                  END);
  1952.           END;
  1953.    MODIFIERS: Word;
  1954.  END
  1955.  
  1956.  #-- Doing the same thing with a target program variable
  1957.  #-- of type EventRecord. The %t format specifier lets
  1958.  #-- the Printf display format be controlled by the
  1959.  #-- type of the variable displayed.
  1960.  
  1961.  typeof(myEvent)
  1962.    EVENTRECORD
  1963.  
  1964.  Printf "%t", myEvent
  1965.  RECORD
  1966.    WHAT: 3;
  1967.    MESSAGE: 16686;
  1968.    WHEN: 284053;
  1969.    WHERE: RECORD
  1970.             CASE Word OF
  1971.               (1):
  1972.                 (RECORD
  1973.                    V: 272;
  1974.                    H: 267;
  1975.                  END)
  1976.               (- - -);
  1977.           END;
  1978.    MODIFIERS: 2432;
  1979.  END
  1980. -
  1981. Proc ...End —defines a SADE procedure
  1982.  Syntax    
  1983.      Proc  name [ argName ,... ]
  1984.         commands
  1985.     End
  1986.         or
  1987.     Proc  name  [ ( argName ,... ) ]
  1988.         commands
  1989.     End
  1990.  
  1991.  Description
  1992.      SADE procedures are delimited by the Proc...End construct. The procedure name 
  1993.  is followed by an optional parameter list; if present, the list identifies parameters 
  1994.  by name only. Parameters are not assigned a type but instead take on the types of the 
  1995.  actual parameter values when the procedure is called. You can enclose the parameter 
  1996.  list in parentheses if you wish, but if you do so, you must also use parentheses 
  1997.  when calling the procedure (and vice versa).
  1998.     When you call a procedure, the number of actual parameters that you pass 
  1999.  need not match the number of formal parameters in the procedure definition. If you 
  2000.  pass fewer parameters than the number of formal parameters, SADE assigns a special 
  2001.  undefined value to the formal parameters for which there are no corresponding actual 
  2002.  parameters. 
  2003.     If you pass more actual parameters than there are formal parameters, SADE ignores 
  2004.  the extra parameters unless you use the predefined SADE variables Arg and Nargs in 
  2005.  your procedure definition. Arg is an array variable that has the form Arg[n]  
  2006.  where n is the nth actual parameter passed when the procedure is called. Nargs 
  2007.  contains the number of actual parameters. These two predefined variables enable you 
  2008.  to write flexible procedures when you don’t know how many parameters will actually be 
  2009.  passed when the procedure is called. Two of the examples show a simple for loop that 
  2010.  uses Arg and Nargs to set multiple break points. Note that the values of these 
  2011.  variables represent the parameter state of the currently active procedure and are not 
  2012.  defined outside of it.
  2013.     You must define a procedure before making a call to it. Therefore, if you want 
  2014.  mutually recursive procedures, you must first define a “dummy” procedure (similar 
  2015.  to a Pascal FORWARD definition). You can then write a second procedure that calls 
  2016.  the dummy procedure, and then redefine the dummy procedure to do what you want 
  2017.  (including calling the second procedure). The minimal dummy procedure definition is:  
  2018.  Proc foo; End;.
  2019.     You can nest procedure calls.
  2020.  
  2021.  Examples
  2022.  
  2023.  #-- This example illustrates the use of the Nargs and Arg variables to write a 
  2024.  #-- procedure that will accept an indefinite number of parameters. When you call 
  2025.  #-- this procedure, it sets a breakpoint on each parameter that you pass. Nargs 
  2026.  #-- contains the number of the last parameter passed; Arg is used like an array 
  2027.  #-- variable to accesses each parameter by number. Therefore, the loop is in effect 
  2028.  #-- for the first through the last parameter passed, and each parameter is passed 
  2029.  #-- in turn to the Break command by way of the count and arg variables. 
  2030.  
  2031.  Proc SetBreaks ()
  2032.     Define count
  2033.     For count := 1 to Nargs
  2034.         Break Arg[count]
  2035.     End
  2036.  End
  2037.  
  2038.  #-- Call SetBreaks to set breakpoints on DrawWindow, EventLoop, SetLight
  2039.  
  2040.  SetBreaks (DrawWindow, EventLoop, SetLight)
  2041.  
  2042.  See also    Func
  2043. -
  2044. Quit —quits SADE
  2045.  Syntax    
  2046.      Quit
  2047.  
  2048.  Description
  2049.      The Quit command terminates SADE and passes control to another process as
  2050.  determined by MultiFinder. Be aware that Quit kills any suspended applications. 
  2051.  
  2052.  See also    Shutdown
  2053. -
  2054. Redirect —redirects output
  2055.  Syntax    
  2056.      Redirect  [ append ]  filename
  2057.         or
  2058.     Redirect  [ pop ] [ all ]
  2059.  
  2060.  Description
  2061.      The Redirect command redirects the output from SADE commands to the specified 
  2062.  file. The append parameter instructs SADE to append output to the end of the 
  2063.  specified file rather than replacing the contents of the file. You can also use the 
  2064.  § character (Option-6) to replace or append to the selection in an open window 
  2065.  see the example below).
  2066.     You can nest Redirect commands to as many as 10 different files; SADE maintains 
  2067.  the names of these files as a last-in, first-out queue. If you use the pop keyword, 
  2068.  or if you use no parameters at all, the output from SADE commands is redirected to 
  2069.  the file at the head of the queue. If you specify all or pop all, standard output 
  2070.  is redirected to the current command window.
  2071.     Warning: Be aware that if you use use Redirect to replace the contents of a 
  2072.  file that’s not open, there’s no way to undo it. (If the file is open, you can 
  2073.  close it and respond “No” when the dialog asks whether to save changes.)
  2074.     Note: Any error conditions cause SADE to perform an implicit pop all for any 
  2075.  redirected files; this ensures that output returns to the current command window.
  2076.  
  2077.  Examples
  2078.  
  2079.  #-- Redirects output to the current selection in the file whyNot.
  2080.  
  2081.  Redirect "whyNot.§"
  2082.  
  2083.  #-- Create a file to hold output from SADE. Entering a string echoes the string. 
  2084.  #-- That output is redirected to the file, becoming the file's contents. Here the 
  2085.  #-- string is a comment and a SADE command to execute the contents of the next 
  2086.  #-- file in the chain.
  2087.  
  2088.  Open 'exec1'
  2089.  Redirect 'exec1'
  2090.     '"\n executing exec1 now"'
  2091.     "Execute 'exec2'"
  2092.  
  2093.     Open "exec2"
  2094.     Redirect 'exec2'
  2095.         "'Now executing exec2'"
  2096.         "Execute 'exec3'"
  2097.  
  2098.         Open "exec3"
  2099.         Redirect 'exec3'
  2100.             '"Done in exec3"'
  2101.  
  2102.  Redirect pop all
  2103.  Execute "exec1"
  2104.  
  2105.  Alert "Try a tile windows here\n∂
  2106.     Then look at the worksheet for output"
  2107.  
  2108.  #-- output
  2109.  
  2110.  Executing exec1 now
  2111.  Now executing exec2
  2112.  Done in exec3
  2113. -
  2114. Repeat ...Until —conditionally repeats commands 
  2115.  Syntax    
  2116.      Repeat
  2117.         commands
  2118.     Until Boolean
  2119.  
  2120.  Description
  2121.      The Repeat...Until construct provides conditional looping with a test at the end
  2122.  of the loop. The enclosed commands are executed until Boolean is true. The enclosed
  2123.  commands are executed at least once.
  2124.     Repeat constructs may be nested.
  2125.  
  2126.  Example
  2127.  
  2128.  Define count := 0
  2129.  Repeat
  2130.     Printf "%d\n", count
  2131.     count := count + 1
  2132.  Until count = 5
  2133.  
  2134.  #-- output
  2135.  
  2136.  0
  2137.  1
  2138.  2
  2139.  3
  2140.  4
  2141.  
  2142.  See also    Leave
  2143. -
  2144. Request —displays request dialog box
  2145.  Syntax    
  2146.      Request ( string [, string ] )
  2147.  
  2148.  Description
  2149.      Request returns a string after displaying a request dialog box. The dialog 
  2150.  presents an OK button and a Cancel button. The first string argument appears in the 
  2151.  dialog box as the request message. The second, optional string argument specifies a 
  2152.  default string to present in the request box.
  2153.     When you click Cancel, Request returns the string "_CANCEL_" . Otherwise, it 
  2154.  returns the string that you enter in the box.
  2155.  
  2156.  Example
  2157.  
  2158.  Request('Choose a name','Homer')
  2159.  
  2160.  See also    Confirm
  2161. -
  2162. Resource —displays the resource map
  2163.  Syntax    
  2164.      Resource [ display ] [ addr ] [ restype 'type ' ]
  2165.         or
  2166.     Resource check [ addr ]
  2167.     
  2168.  Description
  2169.      The Resource command displays the contents of your application’s resource maps
  2170.  and the system resource map. If you want to display only a particular map, addr
  2171.  should be the address of the map. The information displayed for each map 
  2172.  includes:  its location, the resource ID, the resource type, the value of the master 
  2173.  pointer, whether the resource is locked or unlocked, and the resource name. If a 
  2174.  resource isn’t loaded, the master pointer field shows “NotLoaded.” The default, if 
  2175.  you don’t specify any options, is to display the resource maps, so you can omit 
  2176.  the display option if you wish.
  2177.     You can also restrict the display to a particular resource type by using the 
  2178.  restype keyword with the desired type. Note that type is case-sensitive and should 
  2179.  be enclosed in single quotation marks ('WIND', for example).
  2180.      The Resource check command checks the target application’s resource maps for
  2181.  consistency. If you want to check a particular map, addr should point to the 
  2182.  address of the map. If an inconsistency is found, the command displays a diagnostic 
  2183.  message specifying the problem.
  2184.  
  2185.  Example
  2186.  
  2187.  Resource restype 'MENU'
  2188.  
  2189.  #-- output
  2190.  
  2191.  Resource Map at $00501E8C
  2192.    ResId  RType  MasterPtr  Locked?   Name
  2193.      128  MENU   $00501E8C  Unlocked  
  2194.      129  MENU   $00501EC0  Unlocked  
  2195.      130  MENU   $00501F50  Unlocked  
  2196.      131  MENU   $00501FA0  Unlocked  
  2197.  Resource Map at $0010CF68
  2198.    ResId  RType  MasterPtr  Locked?   Name
  2199.    33024  MENU   NotLoaded            
  2200.    49046  MENU   $0010EC94  Unlocked  
  2201.    49047  MENU   $001683F8  Unlocked  
  2202.    49063  MENU   $000DF76C  Unlocked  
  2203.    49064  MENU   $0010E764  Unlocked  
  2204.    49065  MENU   $0010E794  Unlocked  
  2205.    61536  MENU   NotLoaded           
  2206. -
  2207. Return —returns from a procedure or function
  2208.  Syntax    
  2209.      Return [ result ]
  2210.  
  2211.  Description
  2212.      The Return command returns you from a procedure or function currently in execution.
  2213.  When returning from a function, the function result must be specified. (When 
  2214.  returning from a procedure, there is no return value.) 
  2215.     Result is an expression that specifies the return value.
  2216.  
  2217.  Example    
  2218.  
  2219.  Define global SadeArray[4] := (1, "this is two", 3.3, 4)
  2220.  Func MiscTypes (index)
  2221.     Return SadeArray[index]
  2222.  End
  2223.  
  2224.  Define selector
  2225.  For selector := 1 to 4 do
  2226.     Printf "%t \n", MiscTypes(selector)
  2227.  End
  2228.  
  2229.  #-- output
  2230.  
  2231.  1
  2232.  this is two
  2233.  3.3
  2234.  4
  2235.  
  2236.  See also    Func, Proc
  2237. -
  2238. SADEKey —defines a key for entering SADE
  2239.  Syntax    
  2240.      Sadekey [ keycode ]
  2241.  
  2242.  Description
  2243.      The SADEKey command lets you specify a different Command-Option key combination 
  2244.  for entering SADE. To see what key is specified as the SADEKey, just type SADEKey.
  2245.  A complete list of keycodes can be found in the Toolbox Event Manager chapter of 
  2246.  Inside Macintosh Volume V. 
  2247.  
  2248.  Example    
  2249.  
  2250.  sadekey $33    #-- define Command-Option-Delete combination as SADEKey
  2251. -
  2252. Save —saves a file
  2253.  Syntax    
  2254.      Save [ all | filename ]
  2255.  
  2256.  Description
  2257.      The Save command saves the specified file or, if all is specified, saves all 
  2258.  files. If the specified file wasn’t modified since the last time it was saved, 
  2259.  Save does nothing. If no parameters are given, Save saves the target window. Filename 
  2260.  is a string expression and you must enclose it in quotation marks if it’s a string 
  2261.  constant. 
  2262.  
  2263.  Example
  2264.  
  2265.  Save 'myFile'
  2266.  
  2267.  See also    Open, Close
  2268. -
  2269. Selection —returns text of current selection
  2270.  Syntax    Selection ( windowName )
  2271.  
  2272.  Description
  2273.      Selection returns the text of the current selection in the specified window. 
  2274.  The value returned is of type PString. To get the value of the string if it contains 
  2275.  a name or expression (for instance, to set a breakpoint), apply the Eval function 
  2276.  on the string.
  2277.  
  2278.  Example
  2279.  
  2280.  #-- Return the string that is highlighted in the active window, that is, the 
  2281.  #-- frontmost window.
  2282.  
  2283.     Selection (ActiveWindow)
  2284.  
  2285.  See also    Eval
  2286. -
  2287. Shutdown —shuts down or restarts the machine
  2288.  Syntax    
  2289.      Shutdown [ restart ]
  2290.  
  2291.  Description
  2292.      The Shutdown command terminates SADE and calls the Shutdown Manager. Be aware 
  2293.  that all unsaved work is lost. Specifying restart will restart the Macintosh after 
  2294.  shutting down.
  2295. -
  2296. SizeOf —returns size of variable, type, or argument
  2297.  Syntax    
  2298.      SizeOf ( variable | type | argument )
  2299.  
  2300.  Description
  2301.      SizeOf returns the number of bytes occupied by a variable or type. You can also
  2302.  use SizeOf to determine the size of an argument to a SADE procedure or function.
  2303.  You cannot use SizeOf with SADE array variables.
  2304.  
  2305.  Example
  2306.  
  2307.  #-- This example shows the size of the SADE type, Long.
  2308.  
  2309.  SizeOf(long)
  2310.  
  2311.  #-- output
  2312.  
  2313.  4
  2314.  
  2315.  See also    Length
  2316. -
  2317. SizeWindow —sets a window’s size
  2318.  Syntax    
  2319.      SizeWindow [ to h,v ] [window ]
  2320.  
  2321.  Description
  2322.      SizeWindow sets the size of the specified window to the specified horizontal
  2323.  and vertical dimensions. If the size specified would cause the window to be too big
  2324.  for the screen, SADE returns an error message. Window is the name of the window 
  2325.  to size. If you do not specify a window, SADE uses the target window (second 
  2326.  from the front).
  2327.     The keyword To is followed by the horizontal and vertical dimensions (in 
  2328.  pixels) of the window in that order. They are nonnegative integers. Separate 
  2329.  them by a comma.
  2330.  
  2331.  Examples    
  2332.  
  2333.  #-- Make the target window 200 pixels square in size. Note that a there are 
  2334.  #-- about 72 pixels per inch on the Macintosh display screen. 
  2335.  
  2336.  SizeWindow To 200, 200
  2337.  
  2338.  #-- Display the size of the sample.c window:
  2339.  
  2340.  SizeWindow 'sample.c'
  2341.  
  2342.  #-- output
  2343.  
  2344.  SIZEWINDOW 630 393 sample.c
  2345.  
  2346.  #-- Make the Worksheet window 500 x 100 pixels in size. Note the use of 
  2347.  #-- the built-in Concat function to concatenate the directory path defined 
  2348.  #-- by sadedir with the name of the SADE Worksheet.
  2349.  
  2350.  SizeWindow To 500, 100 Concat(sadedir,'SADE Worksheet')
  2351.  
  2352.  See also    MoveWindow, WindowSize 
  2353. -
  2354. SourcePath —tells SADE where your source files are
  2355.  Syntax    
  2356.      Sourcepath [ [ add | del[ete ] ] directoryName , ... ]
  2357.  
  2358.  Description
  2359.      The SourcePath command tells SADE what directory your source files are in. If 
  2360.  your source files are in more than one directory, you can give the SourcePath 
  2361.  command a list. The a list of directory names must be separated by commas.
  2362.      If you’re unsure which directories you’ve specified, simply enter 
  2363.  Sourcepath and the current search path is displayed. 
  2364.      Specifying the add parameter will add a directory to the list of directories 
  2365.  in the search path. Specifying del[ete] deletes a directory from the list of 
  2366.  directories in the search path.
  2367.  
  2368.     Warning: If you specify a directory without using the add keyword, any 
  2369.  directories previously specified are replaced.
  2370.  
  2371.  Examples
  2372.  
  2373.  Sourcepath 'srcdir', ':otherdir'  # sources in more than one directory
  2374.  
  2375.  Sourcepath add ":samples"         # add directory Samples to search path
  2376.  
  2377.  See also    Directory
  2378. -
  2379. SourceToAddr —returns address of source statement
  2380.  Syntax    
  2381.      SourceToAddr ( windowName [, errorFlag ] )  
  2382.  
  2383.  Description
  2384.      SourceToAddr returns the address corresponding to the statement selected in the
  2385.  specified window. The window need not be active. SourceToAddr displays the address 
  2386.  symbolically; SourceToAddr returns zero if it cannot determine the address. If you 
  2387.  pass a nonzero value in the optional errorFlag, SourceToAddr returns a string 
  2388.  describing why the address could not be found.
  2389.  
  2390.  Example 
  2391.  
  2392.  #-- SourceToAddr returns the address of the statement that a user has highlighted 
  2393.  #-- in the target (source code) window. If the user has highlighted code that 
  2394.  #-- does not represent a statement, that is, if SourceToAddr returns a Pstring, 
  2395.  #-- then SADE returns an error to the user. Note that this code is similar to code 
  2396.  #-- in the SADEStartup file that implements the Statement Selected Is? item in the 
  2397.  #-- SourceCmds menu.
  2398.  
  2399.  foo := SourceToAddr(targetWindow,1)
  2400.  If TypeOf(foo) = 'PString' then
  2401.     #report error in foo
  2402.  else
  2403.     #foo has address
  2404.  
  2405.  See also    AddrToSource
  2406. -
  2407. Stack —displays stack frames
  2408.  Syntax    
  2409.      Stack  [ count ] [ at addr ]
  2410.  
  2411.  Description
  2412.      The Stack command displays a list of the stack frames for the target application. 
  2413.  The stack frames displayed are based on register A6 or addr if at is specified. 
  2414.  For each entry, Stack gives the address of the stack frame, the name of the 
  2415.  procedure or function that allocated the frame, and the name and offset (if 
  2416.  available) of the parent procedure.
  2417.     The count parameter is the maximum number of stack frames to display counting 
  2418.  back from the current frame).
  2419.  
  2420.  Example
  2421.  
  2422.  Stack at DisplayText.(6)
  2423.  Stack
  2424.   Frame Addr  Frame Owner   Called From
  2425.     <main>      %__MAIN
  2426.     $0032BC24   main          %__MAIN+$0028
  2427.     $0032BB2C   SkelMain      main.(51)
  2428.     $0032BB0C   LogEvent      SkelMain.(13)+$0012
  2429.     $0032BADC   ReportUpdate  LogEvent.(50)+$0004
  2430.     $0032BACC   DisplayText   ReportUpdate.(1)+$0004
  2431. -
  2432. Step —executes single step 
  2433.  Syntax    
  2434.      Step [ asm | line ] [ into ] [ onEntry commands ]
  2435.  
  2436.  Description
  2437.      The Step command lets you execute your program one step at a time, from either 
  2438.  the source code level or the object code level. 
  2439.     Specify line to perform source-level debugging. This is the default, so you can 
  2440.  omit this option if you wish. Specify into to step into subroutines. The default, 
  2441.  if you omit this parameter, is to step over subroutines.
  2442.     Specify asm to perform object-code (assembly-language) debugging. The default, 
  2443.  if you omit this parameter, is source-level debugging. If you specify asm, execution 
  2444.  proceeds one instruction at a time; the instruction at the program counter is 
  2445.  executed and SADE is re-entered. SADE always treats traps as single instructions; 
  2446.  SADE steps over them, stopping at the first instruction following the trap. You can 
  2447.  either step into or over subroutines called by JSR and BSR instructions. If you 
  2448.  specify into, SADE steps in, stopping at the first instruction of the subroutine. 
  2449.  If you omit into, SADE treats BSR (branch to subroutine) and JSR (jump to subroutine)
  2450.  instructions as single instructions.
  2451.     The onEntry commands option is used to specify actions to occur upon returning 
  2452.  to SADE after stepping the program—for example, to display the value of a variable. 
  2453.  This option is required if you want to execute more than one step at a time as part 
  2454.  of a script or SADE procedure. If you do not use onEntry but execute the Step command
  2455.  as part of a group of commands (in a script file or highlighted in the Worksheet) 
  2456.  SADE evaluates the other commands first before executing the Step command regardless 
  2457.  of the order in which you place the commands in the script or in the Worksheet. 
  2458.  This means, for example, if you place a command such as Printf after a Step command 
  2459.  to display the value of a variable, and execute the commands together, Printf 
  2460.  displays the value of the variable before, not after, the step. 
  2461.  
  2462.     Important: You cannot execute more than one Step command at a time, whether as 
  2463.  part of a script or as a highlighted group of commands unless you use the onEntry 
  2464.  keyword. With onEntry you can tell SADE to execute another Step command after 
  2465.  returning to SADE following the first step.
  2466.  
  2467.     Warning: Don’t try to step over a routine that does not return to the caller; for 
  2468.  instance, a call to longjmp(). SADE steps over procedure and function calls by 
  2469.  setting the trace bit until after the JSR or BSR is executed, and then replaces the 
  2470.  return address with the address of a SADE routine. Since longjmp() restores a 
  2471.  previously saved register set, including a new stack pointer, SADE’s return is lost. 
  2472.  If you want to go to the routine restored by longjump0, execute Step asm into until 
  2473.  the registers have been modified and then do a source step. Or better still, if you 
  2474.  know where the jump will go, set a breakpoint in that routine.
  2475.  
  2476.  Examples    
  2477.  
  2478.  #-- If these two commands are executed together, SADE displays the value of 
  2479.  #-- newStopped before stepping the program (remember that SADE evaluates all 
  2480.  #-- other commands in a script before executing a Step command). 
  2481.  
  2482.  Step
  2483.  Printf "The value of newStopped is %d",newStopped 
  2484.  
  2485.  #-- output - value of newStopped before step
  2486.  
  2487.  #-- Use the onEntry keyword to display the value of a variable after stepping. 
  2488.  #-- Note in the second example that the Printf command is part of the Step command—it
  2489.  #-- belongs to the action specified by onEntry—so it must be on the same line as Step 
  2490.  #-- or, as in this case, made part of the line by the continuation character (∂).
  2491.  
  2492.  Step onEntry ∂
  2493.     Printf "The value of newStopped is %d",newStopped 
  2494.  
  2495.  #-- output - value of newStopped after step
  2496.  
  2497.  #-- You can use the Begin..End construct to execute multiple commands as part of the 
  2498.  #-- action specified by onEntry. This example displays the value of three different 
  2499.  #-- variables after stepping.
  2500.  
  2501.  Step onEntry Begin
  2502.     Printf "The value of newStopped is %d\n",newStopped 
  2503.     Printf "The value of gStopped is %d\n",gStopped 
  2504.     Printf "The value of menuID is %d\n",menuID 
  2505.  End
  2506.  
  2507.  #-- To step through a program using a script or a block of SADE commands, you
  2508.  #-- must use the onEntry command. The following procedure uses onEntry to step 
  2509.  #-- a given number of times (in this case three times); the onEntry command tells 
  2510.  #-- SADE what to do after each step. In this case, onEntry instructs SADE to 
  2511.  #-- take another step.
  2512.  
  2513.  define StepCount
  2514.  proc __Step__
  2515.     if (StepCount > 0)
  2516.         StepCount := StepCount - 1;
  2517.         step OnEntry __step__
  2518.     end
  2519.  end
  2520.  proc StepN(__n__)
  2521.     StepCount := __n__
  2522.     Step OnEntry __Step__
  2523.  end
  2524.  
  2525.  StepN (3)    # Step three times
  2526.  
  2527. -
  2528. Stop —terminate break action
  2529.  Syntax    
  2530.      Stop
  2531.  
  2532.  Description
  2533.      The Stop command terminates the current break action and returns you to SADE. 
  2534.  If the current execution was within a structured statement (Begin...End, for 
  2535.  instance), or if multiple commands were selected, the pending commands are executed. 
  2536.  To terminate a break action and cancel pending commands, use the Abort command.
  2537.  
  2538.  Example    
  2539.  
  2540.  Directory  'VolName:Path:toMyProg:'
  2541.  Target 'myProg'
  2542.  
  2543.  Proc WhichEvent(stopType)
  2544.     Define global EventType[16] := ('null',
  2545.     'mouse-down','mouse-up',
  2546.     'key-down', 'key-up','auto-key',
  2547.     'update', 'disk-inserted','activate',
  2548.     'network', 'device driver', 'app1',' app2', 'app3', 'app4')
  2549.  
  2550.     If theEvent.what  = stopType then
  2551.         Printf "%P received, stopping\n", EventType[stopType+1]
  2552.         Stop
  2553.     else
  2554.         EventType[theEvent.what+1]
  2555.         Printf
  2556.     End
  2557.  End
  2558.  
  2559.  Break _waitNextEvent from applzone..applzone^ whichEvent(1)
  2560.  Go
  2561.  
  2562.  #-- output
  2563.  
  2564.  key-down
  2565.  update
  2566.  key-down
  2567.  mouse-down received, stopping
  2568.  
  2569.  See also    Abort, Break, Quit
  2570. -
  2571. Target —identify your application
  2572.  Syntax    
  2573.      Target [ progName [ using symbolFileName ] [ onEntry commands ] ]
  2574.  
  2575.  Description
  2576.      The Target command tells SADE the name of the application you want to debug and 
  2577.  identifies the symbol file (the .SYM file generated by the linker). Target also 
  2578.  launches the application, stopping at the first line of the main program, and opens 
  2579.  the source file containing main. To find out what the current target is, just type 
  2580.  Target. To release the current target application (for example, if an application is 
  2581.  targeted by SADE, you cannot relink it until you release it) use Target with a null
  2582.  string enclosed by double quotation marks, that is, Target "".
  2583.     progName is the name of the application to debug. Enclose it in quotation 
  2584.  marks if it is a string constant. If you omit progName, SADE returns the name of the 
  2585.  current target application. 
  2586.      SymbolFileName is the name of the symbol file generated by the linker. Enclose it
  2587.  in quotation marks if it is a string constant. If the .SYM file is already in the 
  2588.  same directory as the application and is called progName.SYM (which it usually is), 
  2589.  you don't need to bother with the using option. 
  2590.     The onEntry option is used to specify actions to occur upon returning to SADE 
  2591.  after launching the program.
  2592.     Note: If you select the Stop Before Constructor menu command, SADE stops 
  2593.  your program as soon as it is launched instead of bringing it to the first line 
  2594.  of main.
  2595.  
  2596.  Examples    
  2597.  
  2598.  #-- The first example specifies the MPW Shell as the target and uses the using 
  2599.  #-- option to specify ToolStuff as the tool to debug. Note that the Target command 
  2600.  #-- automatically opens the source file and breaks at main.(0).
  2601.  
  2602.  SourcePath add "VolName:MPW:ToolStuff:"
  2603.  Target "VolName:MPW:MPW Shell" using "VolName:MPW:ToolStuff:tool.sym"
  2604.  #-- Run tool to break to SADE with tool as target.
  2605.  #-- Target puts pc at main.(0) automatically
  2606.  
  2607.  #-- The Target command in this example puts a breakpoint in the DoMenuCommand 
  2608.  #-- routine and runs the program to that point.
  2609.  
  2610.  Target 'sample1' onEntry Begin
  2611.     break DoMenuCommand
  2612.     Go
  2613.  End
  2614. -
  2615. Timer —returns timing values
  2616.  Syntax    
  2617.      Timer ( [ value [, Boolean ]])  
  2618.  
  2619.  Description
  2620.      Timer uses the global variable TickCount to provide timing-related functions. 
  2621.  If you pass no arguments, Timer returns the current TickCount. If you specify a value
  2622.  (typically a previous value of TickCount), Timer returns the difference between 
  2623.  that value and the current value of TickCount (that is, TickCount–value). If you 
  2624.  also specify a nonzero Boolean value, the difference is returned as a string of the 
  2625.  form "sss.hh", representing seconds and hundredths of a second. (If the Boolean 
  2626.  is zero, it’s ignored.)
  2627.  
  2628.  Example
  2629.  
  2630.  #-- Execute together the lines in the following example to see how long SADE 
  2631.  #-- takes to launch your application.
  2632.  
  2633.  Define starttime := Timer()
  2634.  Target 'sample1' onentry Timer (starttime,1)
  2635. -
  2636. Trace —sets tracepoints
  2637.  Syntax    
  2638.      Trace addr ,…
  2639.         or
  2640.     Trace trap [ from  addrRange ] ,...
  2641.         or
  2642.     Trace trap-range [ from  addrRange ] ,...
  2643.         or
  2644.     Trace all traps [ from  addrRange ] 
  2645.  
  2646.  Description
  2647.      The Trace command sets tracepoints on the specified address or traps within the 
  2648.  target program. You can set tracepoints on a single trap, a range of traps, or on 
  2649.  all traps. After setting the tracepoints, you can resume program execution. When the 
  2650.  program encounters the tracepoint, SADE displays a message on standard output, 
  2651.  reporting the address or trap being traced, with a symbolic representation of the 
  2652.  address if possible. Program execution resumes after SADE displays the message.
  2653.      Addr is a RAM address or symbolic reference. If you use a symbolic reference, 
  2654.  the code need not be in memory at the time you set the tracepoint. 
  2655.      Trap is a trap name or number. You must prefix a trap number with the trap 
  2656.  character (†—Option-t) and a trap name with an underscore character (_InitGraf, for 
  2657.  example).
  2658.     Trap-range specifies a range of traps. Use the range operator (..) between trap 
  2659.  names or numbers. 
  2660.      If addrRange is specified, SADE displays the trace message only when the trap is 
  2661.  called from the specified range.
  2662.     Specifying all traps sets a tracepoint on every trap.
  2663.     You can specify multiple tracepoints, separated by commas, with a single Trace 
  2664. command. 
  2665.     To remove a tracepoint, use the Untrace command.
  2666.  
  2667.  Example
  2668.  
  2669.  #-- These two Trace commands set traces on a range of traps, in the first case 
  2670.  #-- using trap names with the underscore character, and in the second case using 
  2671.  #-- the trap operator with trap numbers.
  2672.  
  2673.  Trace _OpenResFile.._GetResource
  2674.  Trace †$A997..†$A9A0
  2675.  
  2676.  See also    Break, List, Untrace
  2677. -
  2678. TypeOf —return type of an expression
  2679.  Syntax    
  2680.      TypeOf ( expression )   
  2681.  
  2682.  Description
  2683.      TypeOf returns a string containing the name of the type of the given expression. 
  2684.  If SADE doesn’t know the name of the type, it returns a string of the form 
  2685.  "Type  #n ", where n is SADE’s internal index for the type.
  2686. -
  2687. Unbreak —removes breakpoints
  2688.  Syntax    
  2689.      Unbreak addr ,...
  2690.         or
  2691.     Unbreak trap ,...
  2692.         or
  2693.     Unbreak trap-range ,...
  2694.         or
  2695.     Unbreak all  [ traps | addrs ]
  2696.  
  2697.  Description
  2698.      The Unbreak command clears the breakpoint as well as any associated break action, 
  2699.  for the specified addresses or traps. The all option clears all breaks set in the 
  2700.  target program. The all option can also be followed by traps or addrs to restrict 
  2701.  the command to traps or addresses respectively.
  2702.     Addr is a RAM address or symbolic reference. Trap is a trap name or number. You 
  2703.  must prefix a trap number with the trap character (†—Option-t) and a trap name with 
  2704.  an underscore character (_InitGraf, for example). Use the range operator (..) between
  2705.  trap names or numbers to remove breaks set on a range of traps. 
  2706.  
  2707.  Example
  2708.  
  2709.  Unbreak _GetResource    #undo break on GetResource trap
  2710.  
  2711.  See also    Break
  2712. -
  2713. Undef —determines if variable is undefined
  2714.  Syntax    
  2715.      Undef ( parameter | variable )   
  2716.  
  2717.  Description
  2718.      Undef determines whether the given SADE parameter or variable has been 
  2719.  initialized. If the parameter or variable is initialized, Undef returns 0; if it’s 
  2720.  not initialized, Undef returns 1. If you pass an undefined identifier to Undef, 
  2721.  an error results.
  2722. -
  2723. Undefine —removes definitions
  2724.  Syntax    
  2725.      Undefine name ,...
  2726.  
  2727.  Description
  2728.      The Undefine command removes the definition of the specified global SADE variable, 
  2729.  procedure, function, or macro. You can supply a list of names to remove multiple 
  2730.  definitions. Note that Undefine does not remove local variables defined within SADE 
  2731.  procedures or functions. 
  2732.     If you want to redefine an item, you don’t need to use Undefine; you can just 
  2733.  assign a new value to the existing name using the Define command.
  2734.  
  2735.  Example
  2736.  
  2737.  Proc ControlledProc
  2738.     Printf "%d   ", ControllerGlobal
  2739.  End
  2740.  
  2741.  Proc Controller
  2742.     Define global ControllerGlobal
  2743.     Define max := 7
  2744.  
  2745.     For ControllerGlobal := 1 to max
  2746.         ControlledProc
  2747.     End
  2748.  
  2749.     Undefine ControllerGlobal
  2750.     Undefine ControlledProc
  2751.  End
  2752.  
  2753.  #-- output
  2754.  
  2755.  Controller
  2756.  2   3   4   5   6   7
  2757.  
  2758.  ControllerGlobal
  2759.  ### Could not find "ControllerGlobal" as a program symbol
  2760.  
  2761.  ControlledProc
  2762.  ### Could not find "ControlledProc" as a program symbol
  2763.  
  2764.  See also    Proc, Func, Macro, Define
  2765. -
  2766. Untrace —removes tracepoints
  2767.  Syntax    
  2768.      Untrace addr ,…
  2769.         or
  2770.     Untrace trap ,... 
  2771.         or
  2772.     Untrace trap-range ,... 
  2773.         or
  2774.     Untrace all  [ traps | addrs ]
  2775.  
  2776.  Description
  2777.      The Untrace command clears the tracepoint at the specified addresses or traps. 
  2778.  The all keyword clears all tracepoints within the target program. The all keyword  
  2779.  can optionally be followed by the traps or addrs keywords to restrict the command to 
  2780. traps or addresses respectively.
  2781.     Addr is a RAM address or symbolic reference. Trap is a trap name or number. 
  2782.  You must prefix a trap number with the trap character (†—Option-t) and a trap name 
  2783.  with an underscore character (_InitGraf, for example).
  2784.     Specify trap-range to remove traces on a range of traps. Use the range 
  2785.  operator (..) between trap names or numbers. 
  2786.  
  2787.  Example
  2788.  
  2789.  Untrace _GetResource    #undo trace on _GetResource trap
  2790.  
  2791.  See also    Trace
  2792. -
  2793. Version —displays SADE version information
  2794.  Syntax    
  2795.      Version
  2796.  
  2797.  Description
  2798.      The Version command displays the current SADE version number.
  2799. -
  2800. Where —returns symbolic representation of address
  2801.  Syntax    
  2802.      Where ( address )  
  2803.  
  2804.  Description
  2805.      Where returns a string containing a symbolic representation of the given address.
  2806.  
  2807.  Example    
  2808.  
  2809.  #-- Return the source statement corresponding to the program counter (pc).
  2810.  Where(pc)
  2811.  
  2812.  #-- output
  2813.  DoMenuCommand.(31)
  2814.  
  2815.  See also    AddrToSource
  2816. -
  2817. While ...End —conditionally repeats commands
  2818.  Syntax    
  2819.      While  Boolean [ do ]
  2820.         commands
  2821.     End
  2822.  
  2823.  Description
  2824.      The While...End construct provides conditional looping with a test at the 
  2825.  beginning of the loop. The enclosed commands are executed as long as Boolean is true. 
  2826.  If the condition is false at the outset, the enclosed commands are never executed.
  2827.     The do option is not required. It is provided only for consistency with Pascal 
  2828.  usage. As long as the Boolean expression is true, the commands will be executed 
  2829.  whether you specify this option or not.
  2830.     While constructs may be nested.
  2831.  
  2832.  Example
  2833.  
  2834.  Define goSmall := 10
  2835.  While goSmall > -2 do
  2836.     While goSmall > 4 do
  2837.         While goSmall > 7 do
  2838.             Printf "          Inner loop - goSmall = %d\n", goSmall
  2839.             goSmall := goSmall -1
  2840.         End
  2841.         Printf "     Middle loop - goSmall = %d\n", goSmall
  2842.         goSmall := goSmall - 1
  2843.     End
  2844.     Printf "Outer loop - goSmall = %d\n", goSmall
  2845.     goSmall := goSmall - 1
  2846.  End
  2847.  
  2848.  #-- output
  2849.  
  2850.            Inner loop - goSmall = 10
  2851.            Inner loop - goSmall = 9
  2852.            Inner loop - goSmall = 8
  2853.       Middle loop - goSmall = 7
  2854.       Middle loop - goSmall = 6
  2855.       Middle loop - goSmall = 5
  2856.  Outer loop - goSmall = 4
  2857.  Outer loop - goSmall = 3
  2858.  Outer loop - goSmall = 2
  2859.  Outer loop - goSmall = 1
  2860.  Outer loop - goSmall = 0
  2861.  Outer loop - goSmall = -1
  2862.  
  2863.  See also    Leave
  2864. -
  2865. WindowSize —set size of zoom and new windows
  2866.  Syntax    
  2867.      WindowSize zoom | new [ top, left, bottom, right ]
  2868.  
  2869.  Description
  2870.      The WindowSize command allows you to set the size and position that all newly 
  2871.  created windows will take, and to set the size and position a window will take when 
  2872.  you click the Zoom box (upper right corner of the window). Specify the location for 
  2873.  the four corners of the window (in pixels), in the order: top, left, bottom, right. 
  2874.     If you specify new, the coordinates that you specify determine the size and 
  2875.  location of newly created windows in SADE. If you specify zoom, the coordinates 
  2876.  that you specify determine the size and location of windows in SADE when you press 
  2877.  the Zoom box. There is no default; you must specify either zoom or new.
  2878.  
  2879.  Example
  2880.  
  2881.  #-- Specify that new windows will be approximately one inch from the top and one 
  2882.  #-- inch from the bottom, and will be about two inches long and three inches 
  2883.  #-- wide. (There are approximately 72 pixels per inch on the Macintosh screen.)
  2884.  
  2885.  Windowsize new 72,72,144,216
  2886.  
  2887.  See also    MoveWindow, SizeWindow 
  2888.